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):
cmake_minimum_required(VERSION 3.2)
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
endif()
SET(QT_ROOT_DIR "C:/Qt/5.7/msvc2013_64/")
set(QT_QMAKE_EXECUTABLE ${QT_ROOT_DIR}/bin/qmake)
find_package(Qt5 COMPONENTS Quick Core Network Widgets Gui Qml Positioning PATHS ${QT_ROOT_DIR})
project("BEQML")
set(PROJECT_RESOURCES BEQMLResource.qrc)
qt5_add_resources(BEQML_RESOURCES ${PROJECT_RESOURCES})
file(GLOB BEQML_SRC_LIBRARY
"BEQMLLibrary.h" #contains dll import/export defines for windows.
"BEQMLLibraryInitializer.cpp" #dummy class with some functions so the library is created.
"BEQMLLibraryInitializer.h"
)
source_group("Library" FILES ${BEQML_SRC_LIBRARY})
add_library(BEQML SHARED ${BEQML_SRC_LIBRARY} ${BEQML_RESOURCES})
target_include_directories(BEQML PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../BELibraries/)
cmake_minimum_required(VERSION 3.2)
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
endif()
SET(QT_ROOT_DIR "C:/Qt/5.7/msvc2013_64/")
set(QT_QMAKE_EXECUTABLE ${QT_ROOT_DIR}/bin/qmake)
find_package(Qt5 COMPONENTS Quick Core Network Widgets Gui Qml Positioning PATHS ${QT_ROOT_DIR})
project("BEQML")
set(PROJECT_RESOURCES BEQMLResource.qrc)
qt5_add_resources(BEQML_RESOURCES ${PROJECT_RESOURCES})
file(GLOB BEQML_SRC_LIBRARY
"BEQMLLibrary.h" #contains dll import/export defines for windows.
"BEQMLLibraryInitializer.cpp" #dummy class with some functions so the library is created.
"BEQMLLibraryInitializer.h"
)
source_group("Library" FILES ${BEQML_SRC_LIBRARY})
add_library(BEQML SHARED ${BEQML_SRC_LIBRARY} ${BEQML_RESOURCES})
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
Bookmarks