2012-03-09 21:24:43 +00: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 15:09:18 +00: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
|
2013-07-24 18:01:21 +00:00
|
|
|
# Note that trailing newlines will be stripped from actual and expected test
|
2012-03-09 21:24:43 +00:00
|
|
|
# output before matching against the stdout and stderr expressions.
|
2012-04-18 15:09:18 +00: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 21:24:43 +00: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 21:10:36 +00:00
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET}
|
2012-03-09 21:24:43 +00:00
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
|
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
|
2012-12-20 15:16:57 +00:00
|
|
|
${${test}_ARGS}
|
2012-03-09 21:24:43 +00:00
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
|
|
|
|
)
|
|
|
|
endmacro()
|
2012-03-09 21:34:09 +00:00
|
|
|
|
2012-12-20 15:16:57 +00:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
|
|
|
|
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
|
|
|
|
endif()
|
|
|
|
|
2012-12-06 14:59:18 +00:00
|
|
|
add_RunCMake_test(CMP0019)
|
2013-06-04 14:25:47 +00:00
|
|
|
add_RunCMake_test(CMP0022)
|
2013-06-28 14:37:39 +00:00
|
|
|
add_RunCMake_test(CMP0026)
|
2013-06-18 14:33:33 +00:00
|
|
|
add_RunCMake_test(CMP0027)
|
2013-07-30 07:51:56 +00:00
|
|
|
add_RunCMake_test(CMP0028)
|
2013-03-12 22:20:01 +00:00
|
|
|
add_RunCMake_test(CTest)
|
2013-02-18 15:35:53 +00:00
|
|
|
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
|
|
|
|
add_RunCMake_test(CompilerChange)
|
|
|
|
endif()
|
2013-07-09 18:35:49 +00:00
|
|
|
add_RunCMake_test(Configure)
|
2013-10-18 15:54:09 +00:00
|
|
|
add_RunCMake_test(DisallowedCommands)
|
2013-01-25 21:39:57 +00:00
|
|
|
add_RunCMake_test(ExternalData)
|
2013-02-22 13:44:13 +00:00
|
|
|
add_RunCMake_test(FPHSA)
|
2012-08-13 13:49:53 +00:00
|
|
|
add_RunCMake_test(GeneratorExpression)
|
2012-12-10 15:42:33 +00:00
|
|
|
add_RunCMake_test(GeneratorToolset)
|
2012-09-18 11:57:07 +00:00
|
|
|
add_RunCMake_test(TargetPropertyGeneratorExpressions)
|
2012-06-20 15:04:35 +00:00
|
|
|
add_RunCMake_test(Languages)
|
2012-03-12 18:51:30 +00:00
|
|
|
add_RunCMake_test(ObjectLibrary)
|
2012-11-05 11:46:26 +00:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_RunCMake_test(PositionIndependentCode)
|
2013-05-18 10:12:18 +00:00
|
|
|
set(SKIP_VISIBILITY 0)
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2)
|
|
|
|
set(SKIP_VISIBILITY 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES Watcom
|
|
|
|
OR CMAKE_SYSTEM_NAME MATCHES IRIX64
|
|
|
|
OR CMAKE_CXX_COMPILER_ID MATCHES HP
|
|
|
|
OR CMAKE_CXX_COMPILER_ID MATCHES XL
|
|
|
|
OR CMAKE_CXX_COMPILER_ID MATCHES SunPro)
|
|
|
|
set(SKIP_VISIBILITY 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT SKIP_VISIBILITY)
|
|
|
|
add_RunCMake_test(VisibilityPreset)
|
|
|
|
endif()
|
2012-11-05 11:46:26 +00:00
|
|
|
endif()
|
2013-01-19 10:21:14 +00:00
|
|
|
add_RunCMake_test(CompatibleInterface)
|
2012-08-06 13:29:20 +00:00
|
|
|
add_RunCMake_test(Syntax)
|
2012-03-12 18:51:30 +00:00
|
|
|
|
2013-03-29 18:53:36 +00:00
|
|
|
add_RunCMake_test(add_dependencies)
|
2012-03-09 21:47:19 +00:00
|
|
|
add_RunCMake_test(build_command)
|
2012-03-09 21:34:09 +00:00
|
|
|
add_RunCMake_test(find_package)
|
2013-04-16 13:27:51 +00:00
|
|
|
add_RunCMake_test(get_filename_component)
|
2013-05-28 15:13:24 +00:00
|
|
|
add_RunCMake_test(if)
|
2012-07-10 14:55:02 +00:00
|
|
|
add_RunCMake_test(include)
|
2012-10-15 08:27:42 +00:00
|
|
|
add_RunCMake_test(include_directories)
|
2012-04-17 14:32:46 +00:00
|
|
|
add_RunCMake_test(list)
|
2013-09-17 16:54:34 +00:00
|
|
|
add_RunCMake_test(message)
|
2013-10-21 16:49:15 +00:00
|
|
|
add_RunCMake_test(string)
|
2013-05-15 19:19:20 +00:00
|
|
|
add_RunCMake_test(try_compile)
|
2013-06-03 13:23:25 +00:00
|
|
|
add_RunCMake_test(variable_watch)
|
2013-01-16 15:42:39 +00:00
|
|
|
add_RunCMake_test(CMP0004)
|
2013-06-28 09:25:40 +00:00
|
|
|
add_RunCMake_test(TargetPolicies)
|
2013-07-12 07:14:31 +00:00
|
|
|
add_RunCMake_test(alias_targets)
|
2012-11-02 14:47:40 +00:00
|
|
|
add_RunCMake_test(interface_library)
|
2012-04-19 12:35:10 +00:00
|
|
|
|
2013-03-16 17:25:59 +00:00
|
|
|
find_package(Qt4 QUIET)
|
|
|
|
find_package(Qt5Core QUIET)
|
2013-03-26 23:15:08 +00:00
|
|
|
if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
|
2013-03-16 17:25:59 +00:00
|
|
|
add_RunCMake_test(IncompatibleQt)
|
|
|
|
endif()
|
2013-07-04 08:00:27 +00:00
|
|
|
if (QT4_FOUND)
|
|
|
|
set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
|
|
|
add_RunCMake_test(ObsoleteQtMacros)
|
|
|
|
endif()
|
2013-03-16 17:25:59 +00:00
|
|
|
|
2012-04-19 12:35:10 +00:00
|
|
|
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
|
|
|
|
add_RunCMake_test(include_external_msproject)
|
2012-10-14 11:15:33 +00:00
|
|
|
add_RunCMake_test(SolutionGlobalSections)
|
2012-04-19 12:35:10 +00:00
|
|
|
endif()
|
2013-01-02 16:10:04 +00:00
|
|
|
|
|
|
|
add_RunCMake_test(File_Generate)
|
2013-07-22 21:25:21 +00:00
|
|
|
add_RunCMake_test(ExportWithoutLanguage)
|
2013-06-04 14:21:33 +00:00
|
|
|
add_RunCMake_test(target_link_libraries)
|
2013-09-20 13:10:40 +00:00
|
|
|
add_RunCMake_test(CheckModules)
|