Merge topic 'test-RunCMake-updates'

29533380 Tests: Allow RunCMake expected result code to be a regex
a85ee8b8 Tests: Simplify RunCMake test extra argument passing
da7155f5 Tests: Allow RunCMake tests to pass generator expressions
This commit is contained in:
Brad King 2014-12-17 14:44:22 -05:00 committed by CMake Topic Stage
commit 70ffd71db1
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# See adjacent README.rst for documentation of this test infrastructure. # See adjacent README.rst for documentation of this test infrastructure.
macro(add_RunCMake_test test) macro(add_RunCMake_test test)
add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
-DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR}
-DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
@ -9,6 +9,7 @@ macro(add_RunCMake_test test)
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
${${test}_ARGS} ${${test}_ARGS}
${ARGN}
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
) )
endmacro() endmacro()
@ -131,8 +132,7 @@ if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
add_RunCMake_test(IncompatibleQt) add_RunCMake_test(IncompatibleQt)
endif() endif()
if (QT4_FOUND) if (QT4_FOUND)
set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
add_RunCMake_test(ObsoleteQtMacros)
endif() endif()
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)

View File

@ -65,7 +65,7 @@ function(run_cmake test)
) )
endif() endif()
set(msg "") set(msg "")
if(NOT "${actual_result}" STREQUAL "${expect_result}") if(NOT "${actual_result}" MATCHES "${expect_result}")
set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n")
endif() endif()
foreach(o out err) foreach(o out err)