summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt138
1 files changed, 116 insertions, 22 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e07bb69..b660442 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -15,10 +15,7 @@ macro(ADD_TEST_MACRO NAME COMMAND)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
endmacro()
-macro(REGEX_ESCAPE_STRING _OUT _IN)
- # Escape special regex metacharacters with a backslash
- string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}")
-endmacro()
+include(${CMAKE_CURRENT_SOURCE_DIR}/RegexEscapeString.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake)
@@ -245,9 +242,10 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(PolicyScope PolicyScope)
ADD_TEST_MACRO(EmptyLibrary EmptyLibrary)
ADD_TEST_MACRO(CompileDefinitions CompileDefinitions)
+ ADD_TEST_MACRO(CompileOptions CompileOptions)
ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
set_tests_properties(EmptyLibrary PROPERTIES
- PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test")
+ PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
ADD_TEST_MACRO(CrossCompile CrossCompile)
set_tests_properties(CrossCompile PROPERTIES
PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode")
@@ -1003,21 +1001,35 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt")
- if(QT4_WORKS AND QT_QTGUI_FOUND)
- add_test(QtAutomoc ${CMAKE_CTEST_COMMAND}
+ find_package(Qt5Widgets QUIET NO_MODULE)
+ if(Qt5Widgets_FOUND)
+ add_test(Qt5Automoc ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/QtAutomoc"
- "${CMake_BINARY_DIR}/Tests/QtAutomoc"
+ "${CMake_BINARY_DIR}/Tests/Qt5Automoc"
${build_generator_args}
--build-project QtAutomoc
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc"
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Automoc"
--force-new-ctest-process
- --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
+ --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
--test-command ${CMAKE_CTEST_COMMAND} -V
)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc")
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Automoc")
endif()
if(QT4_WORKS AND QT_QTGUI_FOUND)
+ add_test(Qt4Automoc ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/QtAutomoc"
+ "${CMake_BINARY_DIR}/Tests/Qt4Automoc"
+ ${build_generator_args}
+ --build-project QtAutomoc
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Automoc"
+ --force-new-ctest-process
+ --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Automoc")
+
add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Qt4Targets"
@@ -1030,6 +1042,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets")
+
+ if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0)
+ add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc"
+ "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
+ ${build_generator_args}
+ --build-project Qt4And5Automoc
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc"
+ --force-new-ctest-process
+ --test-command ${CMAKE_CTEST_COMMAND} -V
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc")
+ endif()
endif()
add_test(ExternalProject ${CMAKE_CTEST_COMMAND}
@@ -1219,6 +1245,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif()
endif()
+ if(APPLE AND "${DARWIN_MAJOR_VERSION}" GREATER 9)
+ add_test(MacRuntimePath ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/MacRuntimePath"
+ "${CMake_BINARY_DIR}/Tests/MacRuntimePath"
+ ${build_generator_args}
+ --build-project MacRuntimePath
+ )
+ endif()
+
add_test(linkorder1 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/LinkLineOrder"
@@ -1448,6 +1484,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ADD_TEST_MACRO(SBCS SBCS)
endif()
+ if(NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [6789]( |$)"
+ AND NOT CMAKE_TEST_GENERATOR_TOOLSET)
+ ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx)
+ endif()
+
add_test(VSExternalInclude ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VSExternalInclude"
@@ -1495,6 +1536,29 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
unset(_last_test)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild")
endif()
+
+ if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])")
+ if(CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
+ set(MSBUILD_EXECUTABLE "${CMAKE_TEST_MAKEPROGRAM}")
+ else()
+ set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]")
+ set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]")
+ find_program(MSBUILD_EXECUTABLE NAMES msbuild HINTS ${_FDIR}/${_FVER})
+ endif()
+ if(MSBUILD_EXECUTABLE)
+ add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir"
+ "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir"
+ --build-two-config
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-makeprogram "${MSBUILD_EXECUTABLE}"
+ --build-project VSProjectInSubdir
+ --build-target test)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
+ endif()
+ endif()
endif()
if (APPLE)
@@ -1576,17 +1640,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
- add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/VariableUsage"
- "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
- ${build_generator_args}
- --build-noclean
- --build-project WarnUnusedCliUnused
- --build-options "-DUNUSED_CLI_VARIABLE=Unused")
- set_tests_properties(WarnUnusedCliUnused PROPERTIES
- PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+ if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile" AND NOT WIN32)
+ # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails
+ # this test. (See #13371)
+ # Apparently Visual Studio does not support it either. As the MakeClean
+ # test above is only run with the Makefiles generator, only run this
+ # test with the Makefiles generator also.
+ add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused"
+ "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
+ ${build_generator_args}
+ --build-project WarnUnusedCliUnused
+ --build-options "-DUNUSED_CLI_VARIABLE=Unused")
+ set_tests_properties(WarnUnusedCliUnused PROPERTIES
+ PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+ endif()
add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -1637,6 +1707,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# -S "${CMake_BINARY_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake"
# )
+ # A test for ctest_build() with targets in subdirectories
+ if(CMAKE_TEST_GENERATOR_TOOLSET)
+ set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION "-T;${CMAKE_TEST_GENERATOR_TOOLSET};")
+ else()
+ set(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION)
+ endif()
+ configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY)
+ unset(CMAKE_TEST_GENERATOR_TOOLSET_SELECTION)
+ add_test(CTest.BuildCommand.ProjectInSubdir
+ ${CMAKE_CTEST_COMMAND} -S "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake"
+ -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/Nested")
+
set(CTEST_TEST_UPDATE 1)
if(CTEST_TEST_UPDATE)
# Test CTest Update with Subversion
@@ -1910,6 +1994,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
+ ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options)
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"
@@ -2085,6 +2170,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B)
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ add_test(CTestTestFdSetSize ${CMAKE_CTEST_COMMAND}
+ -S "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" -j20 -V --timeout 120
+ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log"
+ )
+
# Use macro, not function so that build can still be driven by CMake 2.4.
# After 2.6 is required, this could be a function without the extra 'set'
# calls.