summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt288
1 files changed, 180 insertions, 108 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c903103..cf7bd75 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -45,26 +45,27 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
# Testing
if(BUILD_TESTING)
- set(CMAKE_TEST_DEVENV "")
- if(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
- if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio")
- set(CMAKE_TEST_MAKEPROGRAM "")
- else()
- set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}")
- endif()
- if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND
- NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
- set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}")
- endif()
+ set(CMake_TEST_DEVENV "")
+ if(CMAKE_GENERATOR MATCHES "Visual Studio [7-9] " AND
+ NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
+ set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}")
endif()
- if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32))
- set(TEST_CompileCommandOutput 1)
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "")
+ else()
+ set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")
+ endif()
+
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32))
+ set(TEST_CompileCommandOutput 1)
+ endif()
endif()
set(MAKE_IS_GNU )
- if(CMAKE_TEST_MAKEPROGRAM MATCHES make)
- execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
+ if(CMAKE_MAKE_PROGRAM MATCHES make)
+ execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
if("${res}" STREQUAL "0")
if("${out}" MATCHES "GNU")
@@ -75,34 +76,38 @@ if(BUILD_TESTING)
# some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR
- CMAKE_TEST_MAKEPROGRAM MATCHES "nmake|gmake|wmake" OR
- CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland")
+ CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR
+ CMAKE_GENERATOR MATCHES "Visual Studio|XCode|Borland")
set(MAKE_SUPPORTS_SPACES 1)
else()
set(MAKE_SUPPORTS_SPACES 0)
endif()
set(build_generator_args
- --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-generator ${CMAKE_GENERATOR}
)
- if(CMAKE_TEST_GENERATOR_TOOLSET)
+ if(CMAKE_GENERATOR_TOOLSET)
list(APPEND build_generator_args
- --build-generator-toolset ${CMAKE_TEST_GENERATOR_TOOLSET}
+ --build-generator-toolset ${CMAKE_GENERATOR_TOOLSET}
)
endif()
set(build_options)
- if(CMAKE_TEST_MAKEPROGRAM)
- list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
+ if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
+ list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
endif()
- add_subdirectory(CMakeLib)
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ add_subdirectory(CMakeLib)
+ endif()
add_subdirectory(CMakeOnly)
add_subdirectory(RunCMake)
add_subdirectory(FindPackageModeMakefileTest)
- add_subdirectory(CTestTestMemcheck)
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ add_subdirectory(CTestTestMemcheck)
+ endif()
# Collect a list of all test build directories.
set(TEST_BUILD_DIRS)
@@ -192,6 +197,9 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(TarTest TarTest)
ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest)
+ ADD_TEST_MACRO(CompileFeatures CompileFeatures)
+ ADD_TEST_MACRO(CMakeCommands.target_compile_features target_compile_features)
+
# assume no resources building to test
set(TEST_RESOURCES FALSE)
# for windows and cygwin assume we have resources
@@ -199,8 +207,8 @@ if(BUILD_TESTING)
set(TEST_RESOURCES TRUE)
endif()
# for borland and watcom there is no resource support
- if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake" OR
- "${CMAKE_TEST_GENERATOR}" MATCHES "Borland")
+ if("${CMAKE_GENERATOR}" MATCHES "WMake" OR
+ "${CMAKE_GENERATOR}" MATCHES "Borland")
set(TEST_RESOURCES FALSE)
endif()
if(TEST_RESOURCES)
@@ -249,7 +257,9 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(SetLang SetLang)
ADD_TEST_MACRO(EmptyProperty EmptyProperty)
ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
- ADD_TEST_MACRO(LoadCommand LoadedCommand)
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ ADD_TEST_MACRO(LoadCommand LoadedCommand)
+ endif()
ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory)
ADD_TEST_MACRO(LinkLanguage LinkLanguage)
ADD_TEST_MACRO(LinkLine LinkLine)
@@ -260,7 +270,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Assembler HelloAsm)
ADD_TEST_MACRO(SourceGroups SourceGroups)
ADD_TEST_MACRO(Preprocess Preprocess)
- set(ExportImport_BUILD_OPTIONS -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
+ set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
ADD_TEST_MACRO(ExportImport ExportImport)
ADD_TEST_MACRO(Unset Unset)
ADD_TEST_MACRO(PolicyScope PolicyScope)
@@ -271,12 +281,30 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(AliasTarget AliasTarget)
ADD_TEST_MACRO(StagingPrefix StagingPrefix)
ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
+ if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
+ set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+ ADD_TEST_MACRO(ConfigSources ConfigSources)
+ endif()
+ ADD_TEST_MACRO(SourcesProperty SourcesProperty)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
+ set(runCxxDialectTest 1)
+ endif()
+ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang
+ AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9)
+ if(NOT APPLE OR POLICY CMP0025)
+ set(runCxxDialectTest 1)
+ endif()
+ endif()
+ if(runCxxDialectTest)
+ ADD_TEST_MACRO(CxxDialect CxxDialect)
+ endif()
set_tests_properties(EmptyLibrary PROPERTIES
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")
- if("${CMAKE_TEST_GENERATOR}" MATCHES "Make")
+ if("${CMAKE_GENERATOR}" MATCHES "Make")
ADD_TEST_MACRO(Policy0002 Policy0002)
endif()
if(CTEST_TEST_OSX_ARCH)
@@ -315,7 +343,7 @@ if(BUILD_TESTING)
MINGW OR
CMAKE_SYSTEM_NAME MATCHES "Linux" OR
CMAKE_SYSTEM_NAME MATCHES "Darwin")
- if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake")
+ if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake")
add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -381,6 +409,9 @@ if(BUILD_TESTING)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")
ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader)
+ ADD_TEST_MACRO(Module.FindDependency FindDependency)
+
+ ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader)
if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
include(CheckCXXCompilerFlag)
@@ -465,7 +496,7 @@ if(BUILD_TESTING)
# build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately),
# mainly it tests that cmake doesn't crash when generating these project files.
- if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
+ if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "KDevelop")
# check which generators we have
execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
@@ -477,7 +508,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator"
--build-two-config
--build-generator "Eclipse CDT4 - Unix Makefiles"
- --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project Simple
--build-options ${build_options}
--test-command Simple)
@@ -492,7 +523,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator"
--build-two-config
--build-generator "CodeBlocks - Unix Makefiles"
- --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project Simple
--build-options ${build_options}
--test-command Simple)
@@ -506,7 +537,7 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator"
--build-two-config
--build-generator "KDevelop3 - Unix Makefiles"
- --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project Simple
--build-options ${build_options}
--test-command Simple)
@@ -517,7 +548,7 @@ if(BUILD_TESTING)
# test for correct sub-project generation
# not implemented in VS 6, VS 7.0, Xcode, or Ninja
- if(NOT CMAKE_TEST_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja")
+ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja")
# run cmake and configure all of SubProject
# but only build the independent executable car
add_test(SubProject ${CMAKE_CTEST_COMMAND}
@@ -536,17 +567,17 @@ if(BUILD_TESTING)
# the bar library which should be referenced because
# foo links to the static library bar, but bar is not
# directly in the foo sub project
- if(CMAKE_TEST_MAKEPROGRAM)
+ if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
set(SubProject-Stage2_BUILD_MAKEPROGRAM
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-makeprogram ${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
)
endif()
add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubProject/foo"
"${CMake_BINARY_DIR}/Tests/SubProject/foo"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
${SubProject-Stage2_BUILD_MAKEPROGRAM}
--build-nocmake
--build-project foo
@@ -567,7 +598,7 @@ if(BUILD_TESTING)
file(WRITE "${_TEST_DIR}/nightly-cmake.sh"
"cd ${_TEST_DIR}
${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=nightly -P ${CMake_SOURCE_DIR}/Utilities/Release/${script}
-${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
+${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake
")
add_test(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
if(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
@@ -785,7 +816,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
- if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*")
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
find_program(RPMBUILD NAMES rpmbuild)
endif()
# Do not try to build RPM
@@ -821,6 +852,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(WIX_LIGHT_EXECUTABLE)
add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND}
+ -C \${CTEST_CONFIGURATION_TYPE}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator"
"${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
@@ -829,6 +861,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-options ${build_options}
--test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
+ "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
-P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
endif()
endif()
@@ -884,7 +917,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(APPLE)
list(APPEND GENLST "DragNDrop")
endif()
- if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*")
+ if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE)
if (NOT ${RPM_ACTIVE} EQUAL -1)
list(APPEND GENLST "RPM")
@@ -995,7 +1028,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(CTEST_RUN_CMakeTestBadCommandLines)
add_test(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND}
-D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines
- -D gen=${CMAKE_TEST_GENERATOR}
+ -D gen=${CMAKE_GENERATOR}
-D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
-P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake
)
@@ -1010,7 +1043,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(CTEST_RUN_CMakeTestMultipleConfigures)
add_test(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND}
-D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures
- -D gen=${CMAKE_TEST_GENERATOR}
+ -D gen=${CMAKE_GENERATOR}
-D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
-P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
)
@@ -1018,16 +1051,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures")
endif()
- add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
- "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
- ${build_generator_args}
- --build-project LoadCommand
- --build-options ${build_options}
- --test-command LoadedCommand
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
+ "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig"
+ ${build_generator_args}
+ --build-project LoadCommand
+ --build-options ${build_options}
+ --test-command LoadedCommand
+ )
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig")
+ endif()
add_test(complex ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -1233,8 +1268,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
COMMAND ${CMAKE_CMAKE_COMMAND}
-DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
-DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate
- -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR}
- -DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
+ -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
+ -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
-DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}
-P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
)
@@ -1405,7 +1440,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args}
--build-project MacRuntimePath
--build-options ${build_options}
- -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}
+ -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
)
endif()
@@ -1452,19 +1487,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
endif()
- if(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
- add_test(kwsys ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Source/kwsys"
- "${CMake_BINARY_DIR}/Tests/kwsys"
- ${build_generator_args}
- --build-project kwsys
- --build-options ${build_options}
- --test-command kwsysTestsCxx testIOS
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
- endif()
-
if(MAKE_SUPPORTS_SPACES)
add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -1511,19 +1533,19 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif ()
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir")
- if(CMAKE_TEST_MSVC)
+ if(MSVC)
ADD_TEST_MACRO(ForceInclude foo)
ADD_TEST_MACRO(PDBDirectoryAndName myexe)
ADD_TEST_MACRO(PrecompiledHeader foo)
endif()
- if(CMAKE_TEST_MSVC OR
- "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles")
+ if(MSVC OR
+ "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles")
ADD_TEST_MACRO(ModuleDefinition example_exe)
endif()
ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables)
- if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
+ if("${CMAKE_GENERATOR}" MATCHES "Makefile")
add_test(MakeClean ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/MakeClean"
@@ -1545,10 +1567,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# Look for evidence that this is a VCExpress build. If so, avoid
# the MFC test by default.
- string(TOLOWER "${CMAKE_MAKE_PROGRAM};${CMAKE_TEST_MAKEPROGRAM}" mkprog)
+ string(TOLOWER "${CMAKE_MAKE_PROGRAM}" mkprog)
if(mkprog MATCHES "vcexpress")
message(STATUS
- "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test")
+ "CMAKE_MAKE_PROGRAM indicates vcexpress, avoiding MFC test")
set(CTEST_RUN_MFC OFF)
endif()
@@ -1569,7 +1591,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# For the Watcom WMake generator, avoid the MFC test by default.
if(CTEST_RUN_MFC)
- if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake")
+ if("${CMAKE_GENERATOR}" MATCHES "WMake")
message(STATUS
"using the Watcom WMake generator, avoiding MFC test")
set(CTEST_RUN_MFC OFF)
@@ -1642,13 +1664,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC")
endif()
- if(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
+ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
if(NOT MSVC60)
ADD_TEST_MACRO(SBCS SBCS)
endif()
- if(NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [6789]( |$)"
- AND NOT CMAKE_TEST_GENERATOR_TOOLSET)
+ if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [6789]( |$)"
+ AND NOT CMAKE_GENERATOR_TOOLSET)
ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx)
endif()
@@ -1674,7 +1696,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command VSMidl)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl")
- if(CMAKE_TEST_DEVENV)
+ if(CMake_TEST_DEVENV)
# The test (and tested property) works with .sln files, so it's skipped when:
# * Using VS6, which doesn't use .sln files
# * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file
@@ -1686,9 +1708,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
--build-config ${config}
--build-two-config
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-makeprogram ${CMAKE_TEST_DEVENV}
- --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-makeprogram ${CMake_TEST_DEVENV}
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project VSExcludeFromDefaultBuild
--test-command ${CMAKE_COMMAND}
-D "activeConfig=${config}"
@@ -1704,15 +1726,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
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_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])")
# This is Visual Studio 10 or above, so the default build tool is MSBuild.
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-generator ${CMAKE_GENERATOR}
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
--build-project VSProjectInSubdir
--build-target test)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir")
@@ -1750,7 +1772,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command
${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE}
-Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest
- -Dgen=${CMAKE_TEST_GENERATOR}
+ -Dgen=${CMAKE_GENERATOR}
-P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest")
@@ -1798,12 +1820,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-options ${build_options}
"--warn-unused-vars")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
- PASS_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:7 \\(set\\):")
+ PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):")
set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
- FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):")
+ FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
- if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile" AND NOT WIN32)
+ if("${CMAKE_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
@@ -1876,11 +1898,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# A test for ctest_build() with targets in subdirectories
set(ctest_configure_options)
- if(CMAKE_TEST_GENERATOR_TOOLSET)
- list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET})
+ if(CMAKE_GENERATOR_TOOLSET)
+ list(APPEND ctest_configure_options -T ${CMAKE_GENERATOR_TOOLSET})
endif()
- if(CMAKE_TEST_MAKEPROGRAM)
- list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM})
+ if(CMake_TEST_EXPLICIT_MAKE_PROGRAM)
+ list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
endif()
configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY)
@@ -2114,6 +2136,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/gtm_coverage.mcov.in"
"${CMake_BINARY_DIR}/Testing/MumpsCoverage/gtm_coverage.mcov")
+ file(REMOVE_RECURSE "${CMake_BINARY_DIR}/Testing/MumpsCoverage/VistA-FOIA")
file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCoverage")
add_test(NAME CTestGTMCoverage
@@ -2122,7 +2145,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
$<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestGTMCoverage PROPERTIES
PASS_REGULAR_EXPRESSION
- "Process file.*XINDEX.m.*Total LOC:.*127.*Percentage Coverage: 85.83.*"
+ "Process file.*ZZCOVTST.m.*Total LOC:.*23.*Percentage Coverage: 82.61*"
ENVIRONMENT COVFILE=)
configure_file(
@@ -2131,6 +2154,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/cache_coverage.cmcov.in"
"${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/cache_coverage.cmcov")
+ file(REMOVE_RECURSE "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/VistA-FOIA")
file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage")
add_test(NAME CTestCacheCoverage
@@ -2139,7 +2163,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
$<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestCacheCoverage PROPERTIES
PASS_REGULAR_EXPRESSION
- "Process file.*XINDEX.m.*Total LOC:.*125.*Percentage Coverage: 85.60.*"
+ "Process file.*ZZCOVTST.m.*Total LOC:.*22.*Percentage Coverage: 86.36.*"
ENVIRONMENT COVFILE=)
# Adding a test case for Python Coverage
@@ -2160,6 +2184,40 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*"
ENVIRONMENT COVFILE=)
+ # Adding a test case for non-python Cobertura Coverage
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/DartConfiguration.tcl.in"
+ "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/DartConfiguration.tcl")
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/coverage.xml.in"
+ "${CMake_BINARY_DIR}/Testing/CoberturaCoverage/coverage.xml")
+ file(COPY "${CMake_SOURCE_DIR}/Tests/CoberturaCoverage/src"
+ DESTINATION "${CMake_BINARY_DIR}/Testing/CoberturaCoverage")
+ add_test(NAME CTestCoberturaCoverage
+ COMMAND cmake -E chdir
+ ${CMake_BINARY_DIR}/Testing/CoberturaCoverage
+ $<TARGET_FILE:ctest> -T Coverage --debug)
+ set_tests_properties(CTestCoberturaCoverage PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "Process file.*CoverageTest.java.*Total LOC:.*18.*Percentage Coverage: 72.22.*"
+ ENVIRONMENT COVFILE=)
+
+
+ # Adding a test case for JaCoCo Coverage
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/DartConfiguration.tcl.in"
+ "${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl")
+ file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage"
+ DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage")
+ add_test(NAME CTestJacocoCoverage
+ COMMAND cmake -E chdir
+ ${CMake_BINARY_DIR}/Testing/JacocoCoverage
+ $<TARGET_FILE:ctest> -T Coverage --debug)
+ set_tests_properties(CTestJacocoCoverage PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "Process file.*CoverageTest.java.*Total LOC:.*17.*Percentage Coverage: 76.47*"
+ ENVIRONMENT COVFILE=)
+
function(add_config_tests cfg)
set(base "${CMake_BINARY_DIR}/Tests/CTestConfig")
@@ -2219,7 +2277,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log"
)
# with watcom the SEGFAULT is not found, it just fails
- if(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake")
+ if(CMAKE_GENERATOR MATCHES "Watcom WMake")
set_tests_properties(CTestTestCrash PROPERTIES
PASS_REGULAR_EXPRESSION "Failed")
else()
@@ -2301,6 +2359,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"All Labels:.* Label1.* Label2")
configure_file(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestLabelRegExp/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ add_test(NAME CTestTestLabelRegExp
+ COMMAND ${CMAKE_CMAKE_COMMAND}
+ -DSOURCE_DIR=${CMAKE_SOURCE_DIR}/Tests/CTestTestLabelRegExp
+ -P ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/Tests/CTestTestLabelRegExp
+ )
+
+ configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake"
@ONLY ESCAPE_QUOTES)
@@ -2370,7 +2439,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestTimeout/testOutput.log"
)
set_tests_properties(CTestTestTimeout PROPERTIES
- PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed")
+ PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*TestSleep *\\.+ *Passed.*timeout correctly killed child")
add_test(
NAME CTestTestRerunFailed
@@ -2448,6 +2517,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set(regex "${regex}|Error message was: ")
set(regex "${regex}([Cc]ould *n.t resolve host")
set(regex "${regex}|[Cc]ould *n.t connect to host")
+ set(regex "${regex}|Failed connect to")
set(regex "${regex}|Empty reply from server")
set(regex "${regex}|The requested URL returned error")
set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)")
@@ -2479,7 +2549,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if (CMAKE_TESTS_CDASH_SERVER)
- set(regex "^([^:]+)://([^/]+)(/.*)$")
+ set(regex "^([^:]+)://([^/]+)(.*)$")
if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}")
set(protocol "${CMAKE_MATCH_1}")
@@ -2487,8 +2557,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set(path "${CMAKE_MATCH_3}")
else ()
set(protocol "http")
- set(server "www.cdash.org")
- set(path "/CDash")
+ set(server "open.cdash.org")
+ set(path "")
message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...")
message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]")
endif ()
@@ -2510,7 +2580,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
)
- if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Ninja")
+ if("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_GENERATOR}" MATCHES "Ninja")
configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES)
add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND}
@@ -2547,7 +2617,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif ()
endif ()
- if("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
+ if("${CMAKE_GENERATOR}" MATCHES Xcode)
set(CMAKE_SKIP_BOOTSTRAP_TEST 1)
endif()
if(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt")
@@ -2592,7 +2662,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-project testf
--build-two-config
--build-options ${build_options}
- -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}
+ -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
--test-command testf)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran")
@@ -2619,7 +2689,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
find_package(Java COMPONENTS Development QUIET)
if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW
- AND NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Xcode")
+ AND NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
get_filename_component(JNIPATH ${JAVA_COMPILE} PATH)
find_file(JNI_H jni.h
"${JNIPATH}/../include"
@@ -2643,7 +2713,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
endif()
# add some cross compiler tests, for now only with makefile based generators
- if(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
+ if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "KDevelop")
# if sdcc is found, build the SimpleCOnly project with sdcc
find_program(SDCC_EXECUTABLE sdcc)
@@ -2796,5 +2866,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
WORKING_DIRECTORY ${CMake_BINARY_DIR}/Utilities/KWStyle)
endif()
- add_subdirectory(CMakeTests)
+ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ add_subdirectory(CMakeTests)
+ endif()
endif()