2012-03-09 16:24:43 -05:00
|
|
|
# This directory contains tests that run CMake to configure a project
|
|
|
|
# but do not actually build anything. To add a test:
|
|
|
|
#
|
|
|
|
# 1.) Add a subdirectory named for the test.
|
|
|
|
#
|
|
|
|
# 2.) Call add_RunCMake_test and pass the test directory name.
|
|
|
|
#
|
|
|
|
# 3.) Create a RunCMakeTest.cmake script in the directory containing
|
|
|
|
# include(RunCMake)
|
|
|
|
# run_cmake(SubTest1)
|
|
|
|
# ...
|
|
|
|
# run_cmake(SubTestN)
|
|
|
|
# where SubTest1..SubTestN are sub-test names each corresponding to
|
|
|
|
# an independent CMake run and project configuration.
|
|
|
|
#
|
|
|
|
# 3.) Create a CMakeLists.txt file in the directory containing
|
|
|
|
# cmake_minimum_required(...)
|
|
|
|
# project(${RunCMake_TEST} NONE) # or languages needed
|
|
|
|
# include(${RunCMake_TEST}.cmake)
|
|
|
|
# where "${RunCMake_TEST}" is literal. A value for RunCMake_TEST
|
|
|
|
# will be passed to CMake by the run_cmake macro when running each
|
|
|
|
# sub-test.
|
|
|
|
#
|
|
|
|
# 4.) Create a <SubTest>.cmake file for each sub-test named above
|
|
|
|
# containing the actual test code. Optionally create files
|
|
|
|
# containing expected test results:
|
2012-04-18 11:09:18 -04:00
|
|
|
# <SubTest>-result.txt = Process result expected if not "0"
|
|
|
|
# <SubTest>-stdout.txt = Regex matching expected stdout content
|
|
|
|
# <SubTest>-stderr.txt = Regex matching expected stderr content
|
|
|
|
# <SubTest>-check.cmake = Custom result check
|
2012-03-09 16:24:43 -05:00
|
|
|
# Note that trailing newlines will be stripped from actual test
|
|
|
|
# output before matching against the stdout and stderr expressions.
|
2012-04-18 11:09:18 -04:00
|
|
|
# The code in <SubTest>-check.cmake may use variables
|
|
|
|
# RunCMake_TEST_SOURCE_DIR = Top of test source tree
|
|
|
|
# RunCMake_TEST_BINARY_DIR = Top of test binary tree
|
|
|
|
# and an failure must store a message in RunCMake_TEST_FAILED.
|
2012-03-09 16:24:43 -05:00
|
|
|
|
|
|
|
macro(add_RunCMake_test test)
|
|
|
|
add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND}
|
|
|
|
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR}
|
2013-02-05 16:10:36 -05:00
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
|
2012-03-09 16:24:43 -05:00
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
|
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
|
2012-12-20 10:16:57 -05:00
|
|
|
${${test}_ARGS}
|
2012-03-09 16:24:43 -05:00
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
|
|
|
|
)
|
|
|
|
endmacro()
|
2012-03-09 16:34:09 -05:00
|
|
|
|
2012-12-20 10:16:57 -05:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
|
|
|
|
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
|
|
|
|
endif()
|
|
|
|
|
2012-12-06 09:59:18 -05:00
|
|
|
add_RunCMake_test(CMP0019)
|
2013-03-12 18:20:01 -04:00
|
|
|
add_RunCMake_test(CTest)
|
2013-02-18 10:35:53 -05:00
|
|
|
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
|
|
|
|
add_RunCMake_test(CompilerChange)
|
|
|
|
endif()
|
2013-01-25 16:39:57 -05:00
|
|
|
add_RunCMake_test(ExternalData)
|
2013-02-22 08:44:13 -05:00
|
|
|
add_RunCMake_test(FPHSA)
|
2012-08-13 09:49:53 -04:00
|
|
|
add_RunCMake_test(GeneratorExpression)
|
2012-12-10 10:42:33 -05:00
|
|
|
add_RunCMake_test(GeneratorToolset)
|
2012-09-18 13:57:07 +02:00
|
|
|
add_RunCMake_test(TargetPropertyGeneratorExpressions)
|
2012-06-20 11:04:35 -04:00
|
|
|
add_RunCMake_test(Languages)
|
2012-03-12 14:51:30 -04:00
|
|
|
add_RunCMake_test(ObjectLibrary)
|
2012-11-05 12:46:26 +01:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_RunCMake_test(PositionIndependentCode)
|
|
|
|
endif()
|
2013-01-19 11:21:14 +01:00
|
|
|
add_RunCMake_test(CompatibleInterface)
|
2012-03-12 14:51:30 -04:00
|
|
|
|
2012-03-09 16:47:19 -05:00
|
|
|
add_RunCMake_test(build_command)
|
2012-03-09 16:34:09 -05:00
|
|
|
add_RunCMake_test(find_package)
|
2012-07-10 10:55:02 -04:00
|
|
|
add_RunCMake_test(include)
|
2012-10-15 10:27:42 +02:00
|
|
|
add_RunCMake_test(include_directories)
|
2012-04-17 10:32:46 -04:00
|
|
|
add_RunCMake_test(list)
|
2013-01-16 16:42:39 +01:00
|
|
|
add_RunCMake_test(CMP0004)
|
2012-04-19 08:35:10 -04:00
|
|
|
|
|
|
|
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
|
|
|
add_RunCMake_test(include_external_msproject)
|
2012-10-14 13:15:33 +02:00
|
|
|
add_RunCMake_test(SolutionGlobalSections)
|
2012-04-19 08:35:10 -04:00
|
|
|
endif()
|