diff options
author | Brad King <brad.king@kitware.com> | 2015-04-17 14:50:13 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-17 14:50:13 (GMT) |
commit | 9efee16a7a092555d4bc40498a1acd957943a834 (patch) | |
tree | 718263cbe7aa3f8f9811fc9cf6daf23613dcb8d1 /Tests | |
parent | f4e5a0e6aa598f7cf0f34c2d7fea54e518615443 (diff) | |
parent | e8fdd5f12a379ce91adcb88acdb4354bc271c911 (diff) | |
download | CMake-9efee16a7a092555d4bc40498a1acd957943a834.zip CMake-9efee16a7a092555d4bc40498a1acd957943a834.tar.gz CMake-9efee16a7a092555d4bc40498a1acd957943a834.tar.bz2 |
Merge topic 'ninja-autogen'
e8fdd5f1 QtAutogen: Workaround rcc CRCRLF newlines on Windows (#15459)
15f1a6b4 Tests/QtAutogen: Avoid touching files in the source tree
3f7c7c65 Tests/QtAutogen: Help Qt5Autogen test find Qt5 on Windows
26b5cc5e Tests/QtAutogen: Enable per-config source tests when possible
45566408 Tests/QtAutogen: Require CMake 3.1 to set policies everywhere
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/QtAutogen/autorcc_depends/res1.qrc.in (renamed from Tests/QtAutogen/autorcc_depends/res1.qrc) | 2 | ||||
-rw-r--r-- | Tests/QtAutogen/autorcc_depends/res1/input.txt.in (renamed from Tests/QtAutogen/autorcc_depends/res1_input.txt) | 0 |
5 files changed, 25 insertions, 10 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1e60abe..b474d32 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1186,10 +1186,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(run_autogen_test QtAutogen) set(run_autouic_test QtAutoUicInterface) endif() + if(NOT CMAKE_CONFIGURATION_TYPES) + set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>) + endif() find_package(Qt5Widgets QUIET NO_MODULE) if(Qt5Widgets_FOUND) - add_test(Qt5Autogen ${CMAKE_CTEST_COMMAND} + add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" "${CMake_BINARY_DIR}/Tests/Qt5Autogen" @@ -1199,6 +1202,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --force-new-ctest-process --build-options ${build_options} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 + ${QtAutogen_BUILD_OPTIONS} --test-command ${run_autogen_test} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") @@ -1218,7 +1222,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") endif() if(QT4_WORKS AND QT_QTGUI_FOUND) - add_test(Qt4Autogen ${CMAKE_CTEST_COMMAND} + add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" "${CMake_BINARY_DIR}/Tests/Qt4Autogen" @@ -1228,6 +1232,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --force-new-ctest-process --build-options ${build_options} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4 + ${QtAutogen_BUILD_OPTIONS} --test-command ${run_autogen_test} ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 0dc98e3..f76d11e 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -1,7 +1,14 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.1) project(QtAutogen) +# Tell find_package(Qt5) where to find Qt. +if(QT_QMAKE_EXECUTABLE) + get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) + get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) + set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) +endif() + if (QT_TEST_VERSION STREQUAL 4) find_package(Qt4 REQUIRED) @@ -67,10 +74,9 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" ) -message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") -if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_TYPES) +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>) - add_definitions(-DTEST_DEBUG_CLASS) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>) endif() # The -no-protection option disables the generation of include guards. Verify @@ -125,6 +131,7 @@ try_compile(RCC_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends" autorcc_depends CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" OUTPUT_VARIABLE output ) if (NOT RCC_DEPENDS) @@ -140,7 +147,7 @@ set(timeformat "%Y%j%H%M%S") file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends/res1_input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1/input.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt index afd95bc..fbe71ad 100644 --- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.1) project(autorcc_depends) set(CMAKE_AUTORCC ON) @@ -15,9 +15,12 @@ else() set(QT_CORE_TARGET Qt5::Core) endif() +configure_file(res1.qrc.in res1.qrc @ONLY) +configure_file(res1/input.txt.in res1/input.txt @ONLY) + add_executable(test_res1 test_res1.cpp - res1.qrc + ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc ) target_link_libraries(test_res1 ${QT_CORE_TARGET}) add_custom_command(TARGET test_res1 POST_BUILD COMMAND diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc b/Tests/QtAutogen/autorcc_depends/res1.qrc.in index cfea618..2a5417b 100644 --- a/Tests/QtAutogen/autorcc_depends/res1.qrc +++ b/Tests/QtAutogen/autorcc_depends/res1.qrc.in @@ -1,5 +1,5 @@ <RCC> <qresource prefix="/"> - <file>res1_input.txt</file> + <file>res1/input.txt</file> </qresource> </RCC> diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt b/Tests/QtAutogen/autorcc_depends/res1/input.txt.in index da62762..da62762 100644 --- a/Tests/QtAutogen/autorcc_depends/res1_input.txt +++ b/Tests/QtAutogen/autorcc_depends/res1/input.txt.in |