Hi,

I'm setting up my environment for a C++/Qt Quick application (Windows VS2013 x64) with cmake. I'm having trouble to get a (shared) library be compiled and linked to my executable and using a resource file from it (just a simple qml file to test the setup.

I have set(CMAKE_AUTOMOC ON) and set(CMAKE_AUTORCC ON) in my root CMakeLists.txt
The CMakeLists.txt of my shared library is as follows (BEQMLResource.qrc is in the same directory as CMakeLists.txt):

Qt Code:
  1. cmake_minimum_required(VERSION 3.2)
  2.  
  3. if(UNIX)
  4. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
  5. endif()
  6.  
  7. SET(QT_ROOT_DIR "C:/Qt/5.7/msvc2013_64/")
  8.  
  9. set(QT_QMAKE_EXECUTABLE ${QT_ROOT_DIR}/bin/qmake)
  10.  
  11. find_package(Qt5 COMPONENTS Quick Core Network Widgets Gui Qml Positioning PATHS ${QT_ROOT_DIR})
  12.  
  13. project("BEQML")
  14. set(PROJECT_RESOURCES BEQMLResource.qrc)
  15. qt5_add_resources(BEQML_RESOURCES ${PROJECT_RESOURCES})
  16. file(GLOB BEQML_SRC_LIBRARY
  17. "BEQMLLibrary.h" #contains dll import/export defines for windows.
  18. "BEQMLLibraryInitializer.cpp" #dummy class with some functions so the library is created.
  19. "BEQMLLibraryInitializer.h"
  20. )
  21. source_group("Library" FILES ${BEQML_SRC_LIBRARY})
  22. add_library(BEQML SHARED ${BEQML_SRC_LIBRARY} ${BEQML_RESOURCES})
  23. target_include_directories(BEQML PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../BELibraries/)
To copy to clipboard, switch view to plain text mode 

When I compile the library, I get two linker errors in qrc_BEQMLResource.obje (unresolved external symbol for qRegisterResourceData and qUnregisterResourceData).
Any idea what can be wrong?
Kind regards,

Jan