Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cmake build
Forum Updated to NodeBB v4.3 + New Features

cmake build

Scheduled Pinned Locked Moved Unsolved General and Desktop
cmakebuild errorbuild failedfetching
1 Posts 1 Posters 223 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sweezyjog
    wrote on 30 Nov 2024, 15:59 last edited by
    #1

    Hi guys,

    I'm trying to develop crossplatform c++ application with qt and cmake. My goal is to make it that way that users don't need to have preinstalled qt to build the project. I don't want to deploy only executable.

    For linux I'm good, I use docker, but I'm really struggling with windows. I'm using fetchcontent but I have always some kind of error.
    I will appreciate any kind of help thanks :)

    this is my CMakeLists.txt

    cmake_minimum_required(VERSION 3.16)
    project(QtAppExample LANGUAGES CXX)
    
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    
    set(CMAKE_CXX_STANDARD 20)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    option(BUILD_SHARED_LIBS "Build shared libraries" ON)
    
    include(FetchContent)
    FetchContent_Declare(
        qtbase
        GIT_REPOSITORY https://github.com/qt/qtbase.git
        GIT_TAG v6.8.0
    )
    FetchContent_MakeAvailable(qtbase)
    
    set(CMAKE_PREFIX_PATH ${qtbase_SOURCE_DIR}/lib/cmake)
    
    find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
    
    add_executable(QtApp src/main.cpp)
    
    target_link_libraries(QtApp PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)
    
    target_compile_definitions(QtApp PRIVATE "PROJECT_SOURCE_DIR=\"${CMAKE_SOURCE_DIR}\"")
    
    if(WIN32)
        add_custom_command(
            TARGET QtApp
            COMMENT "Copy necessary Qt DLLs"
            PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
                ${qtbase_BINARY_DIR}/bin
                $<TARGET_FILE_DIR:QtApp>
        )
    endif()
    
    install(TARGETS QtApp DESTINATION bin)
    

    this is error I keep seeing:

    WARNING: Basic cpp/winrt support missing. Some features might not be available.
    
    ERROR: detected a std::atomic implementation that fails for function pointers.  Please apply the patch corresponding to your Standard Library vendor, found in qtbase/config.tests/atomicfptr
    
    CMake Error at build/_deps/qtbase-src/cmake/QtBuildInformation.cmake:220 (message):
      Check the configuration messages for an error that has occurred.
    Call Stack (most recent call first):
      build/_deps/qtbase-src/cmake/QtBuildInformation.cmake:39 (qt_configure_print_summary)
      build/_deps/qtbase-src/src/plugins/sqldrivers/CMakeLists.txt:80 (qt_print_feature_summary)
    
    
    -- Configuring incomplete, errors occurred!
    
    1 Reply Last reply
    0

    1/1

    30 Nov 2024, 15:59

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved