CMake: Make all tests link to Qt libraries

This is needed as of commit v5.6.0-beta1~483 (Add an automatic use of
the ELF-versioned QtCore symbol, 2015-10-20).  Even if a translation
unit only contains

 #include <QtCore/QString>

 int main(int,char**)
 {
     return 0;
 }

it must link to QtCore which provides the qt_version_tag symbol.

Change-Id: I827c0a7403320e7e5b384d8608face20fcecdaea
Reviewed-by: Stephen Kelly <ske@ableton.com>
This commit is contained in:
Kevin Funk 2016-01-08 15:58:16 +01:00 committed by Kevin Funk
parent 49c743bdb9
commit 000c4358ce
3 changed files with 4 additions and 3 deletions

View File

@ -9,5 +9,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
add_subdirectory(subdir1)
add_executable(exe1 "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
include_directories(${Qt5Core_INCLUDE_DIRS})
add_executable(exe1 main.cpp)
target_link_libraries(exe1 Qt5::Core)

View File

@ -2,4 +2,4 @@
find_package(Qt5Core REQUIRED)
add_executable(exe2 "${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp")
include_directories(${Qt5Core_INCLUDE_DIRS})
target_link_libraries(exe2 Qt5::Core)

View File

@ -11,3 +11,4 @@ add_definitions(${Qt5Core_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
add_executable(myobject main.cpp)
target_link_libraries(myobject Qt5::Core)