From c455674555b263c98fe613612babab3efcf10345 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 10 Feb 2012 16:40:12 +0100 Subject: [PATCH] Make the cmake tests work with a namespace build. Change-Id: I6858c324548373c57963b5ef137772a1f780ec78 Reviewed-by: Oswald Buddenhagen Reviewed-by: Clinton Stimpson Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreConfigExtras.cmake.in | 3 +++ tests/manual/cmake/fail4/CMakeLists.txt | 2 ++ tests/manual/cmake/fail5/CMakeLists.txt | 2 ++ tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt | 2 ++ tests/manual/cmake/pass2/CMakeLists.txt | 2 ++ tests/manual/cmake/pass3/CMakeLists.txt | 2 ++ tests/manual/cmake/pass7/CMakeLists.txt | 1 + 7 files changed, 14 insertions(+) diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 057c8ff..155961b 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -11,3 +11,6 @@ list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/defaul if (NOT \"$${CMAKE_ADD_FPIE_FLAGS}\" STREQUAL \"\") set(Qt5Core_COMPILE_FLAGS "-fPIE") endif() + +list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE) +list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) diff --git a/tests/manual/cmake/fail4/CMakeLists.txt b/tests/manual/cmake/fail4/CMakeLists.txt index dcd4b8b..2466e24 100644 --- a/tests/manual/cmake/fail4/CMakeLists.txt +++ b/tests/manual/cmake/fail4/CMakeLists.txt @@ -7,6 +7,8 @@ find_package(Qt5Core REQUIRED) include_directories(${Qt5Core_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) + qt5_wrap_cpp(moc_files myobject.h) # Test options. The -binary option generates a binary to dlopen instead of diff --git a/tests/manual/cmake/fail5/CMakeLists.txt b/tests/manual/cmake/fail5/CMakeLists.txt index f82a62b..9aedf4a 100644 --- a/tests/manual/cmake/fail5/CMakeLists.txt +++ b/tests/manual/cmake/fail5/CMakeLists.txt @@ -7,6 +7,8 @@ find_package(Qt5Core REQUIRED) include_directories(${Qt5Core_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) + # Test options. The -i option removes the include "myobject.h" from the moc file # causing a compile failure. -> Options work qt5_wrap_cpp(moc_files myobject.h OPTIONS -i) diff --git a/tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt b/tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt index cc1a1bc..fb971f9 100644 --- a/tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt +++ b/tests/manual/cmake/pass(needsquoting)6/CMakeLists.txt @@ -9,6 +9,8 @@ find_package(Qt5Widgets REQUIRED) include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) + set(CMAKE_INCLUDE_CURRENT_DIR ON) qt5_wrap_cpp(moc_files mywidget.h) diff --git a/tests/manual/cmake/pass2/CMakeLists.txt b/tests/manual/cmake/pass2/CMakeLists.txt index ac1bb15..a527446 100644 --- a/tests/manual/cmake/pass2/CMakeLists.txt +++ b/tests/manual/cmake/pass2/CMakeLists.txt @@ -7,6 +7,8 @@ find_package(Qt5Core REQUIRED) include_directories(${Qt5Core_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) + qt5_wrap_cpp(moc_files myobject.h) qt5_add_resources(rcc_files "pass2.qrc") diff --git a/tests/manual/cmake/pass3/CMakeLists.txt b/tests/manual/cmake/pass3/CMakeLists.txt index 11402e2..b836161 100644 --- a/tests/manual/cmake/pass3/CMakeLists.txt +++ b/tests/manual/cmake/pass3/CMakeLists.txt @@ -8,6 +8,8 @@ find_package(Qt5Widgets REQUIRED) include_directories(${Qt5Widgets_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) + set(CMAKE_INCLUDE_CURRENT_DIR ON) qt5_wrap_cpp(moc_files mywidget.h) diff --git a/tests/manual/cmake/pass7/CMakeLists.txt b/tests/manual/cmake/pass7/CMakeLists.txt index f639c16..e7c9b46 100644 --- a/tests/manual/cmake/pass7/CMakeLists.txt +++ b/tests/manual/cmake/pass7/CMakeLists.txt @@ -6,5 +6,6 @@ project(pass7) find_package(Qt5Core REQUIRED) include_directories(${Qt5Core_INCLUDE_DIRS}) +add_definitions(${Qt5Core_DEFINITIONS}) add_executable(myobject main.cpp) -- 2.7.4