cmake build
Unsolved
General and Desktop
-
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!