How to add a .qrc file to an executable with CMake
Unsolved
General and Desktop
-
How can I add the resources.qrc to the executable when the project is seperated by library and executable?
As I have graphics that I want to display on the executable.cmake_minimum_required(VERSION 3.5) project(MyProject VERSION 0.1 LANGUAGES CXX) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Gui Core) add_library(Mylib STATIC map.cpp map.h window.cpp window.h ) add_library(Mylib ::Mylib ALIAS Mylib ) target_include_directories(Mylib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) target_link_libraries(Mylib PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets) set_target_properties(Mylib PROPERTIES AUTOMOC ON AUTOUIC ON AUTORCC ON CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON ) add_executable(MyProject main.cpp ) target_link_libraries(MyProject PUBLIC MyLib::MyLib) set_target_properties(MyProject PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON )