2012-03-10 01:24:43 +04: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 19: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-10 01:24:43 +04:00
|
|
|
# Note that trailing newlines will be stripped from actual test
|
|
|
|
# output before matching against the stdout and stderr expressions.
|
2012-04-18 19: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-10 01:24:43 +04: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-06 01:10:36 +04:00
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
|
2012-03-10 01:24:43 +04:00
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
|
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
|
2012-12-20 19:16:57 +04:00
|
|
|
${${test}_ARGS}
|
2012-03-10 01:24:43 +04:00
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
|
|
|
|
)
|
|
|
|
endmacro()
|
2012-03-10 01:34:09 +04:00
|
|
|
|
2012-12-20 19:16:57 +04:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
|
|
|
|
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
|
|
|
|
endif()
|
|
|
|
|
2012-12-06 18:59:18 +04:00
|
|
|
add_RunCMake_test(CMP0019)
|
2013-03-13 02:20:01 +04:00
|
|
|
add_RunCMake_test(CTest)
|
2013-02-18 19:35:53 +04:00
|
|
|
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
|
|
|
|
add_RunCMake_test(CompilerChange)
|
|
|
|
endif()
|
2013-01-26 01:39:57 +04:00
|
|
|
add_RunCMake_test(ExternalData)
|
2013-02-22 17:44:13 +04:00
|
|
|
add_RunCMake_test(FPHSA)
|
2012-08-13 17:49:53 +04:00
|
|
|
add_RunCMake_test(GeneratorExpression)
|
2012-12-10 19:42:33 +04:00
|
|
|
add_RunCMake_test(GeneratorToolset)
|
2012-09-18 15:57:07 +04:00
|
|
|
add_RunCMake_test(TargetPropertyGeneratorExpressions)
|
2012-06-20 19:04:35 +04:00
|
|
|
add_RunCMake_test(Languages)
|
2012-03-12 22:51:30 +04:00
|
|
|
add_RunCMake_test(ObjectLibrary)
|
2012-11-05 15:46:26 +04:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_RunCMake_test(PositionIndependentCode)
|
|
|
|
endif()
|
2013-01-19 14:21:14 +04:00
|
|
|
add_RunCMake_test(CompatibleInterface)
|
2012-03-12 22:51:30 +04:00
|
|
|
|
2013-03-29 22:53:36 +04:00
|
|
|
add_RunCMake_test(add_dependencies)
|
2012-03-10 01:47:19 +04:00
|
|
|
add_RunCMake_test(build_command)
|
2012-03-10 01:34:09 +04:00
|
|
|
add_RunCMake_test(find_package)
|
2013-04-16 17:27:51 +04:00
|
|
|
add_RunCMake_test(get_filename_component)
|
2013-05-28 19:13:24 +04:00
|
|
|
add_RunCMake_test(if)
|
2012-07-10 18:55:02 +04:00
|
|
|
add_RunCMake_test(include)
|
2012-10-15 12:27:42 +04:00
|
|
|
add_RunCMake_test(include_directories)
|
2012-04-17 18:32:46 +04:00
|
|
|
add_RunCMake_test(list)
|
2013-01-16 19:42:39 +04:00
|
|
|
add_RunCMake_test(CMP0004)
|
2012-04-19 16:35:10 +04:00
|
|
|
|
2013-03-16 21:25:59 +04:00
|
|
|
find_package(Qt4 QUIET)
|
|
|
|
find_package(Qt5Core QUIET)
|
2013-03-27 03:15:08 +04:00
|
|
|
if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
|
2013-03-16 21:25:59 +04:00
|
|
|
add_RunCMake_test(IncompatibleQt)
|
|
|
|
endif()
|
|
|
|
|
2012-04-19 16:35:10 +04:00
|
|
|
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
|
|
|
add_RunCMake_test(include_external_msproject)
|
2012-10-14 15:15:33 +04:00
|
|
|
add_RunCMake_test(SolutionGlobalSections)
|
2012-04-19 16:35:10 +04:00
|
|
|
endif()
|
2013-01-02 20:10:04 +04:00
|
|
|
|
|
|
|
add_RunCMake_test(File_Generate)
|