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
|
2013-07-24 22:01:21 +04:00
|
|
|
# Note that trailing newlines will be stripped from actual and expected test
|
2012-03-10 01:24:43 +04:00
|
|
|
# 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-06-04 18:25:47 +04:00
|
|
|
add_RunCMake_test(CMP0022)
|
2013-06-28 18:37:39 +04:00
|
|
|
add_RunCMake_test(CMP0026)
|
2013-06-18 18:33:33 +04:00
|
|
|
add_RunCMake_test(CMP0027)
|
2013-07-30 11:51:56 +04:00
|
|
|
add_RunCMake_test(CMP0028)
|
2013-11-08 20:44:55 +04:00
|
|
|
add_RunCMake_test(CMP0037)
|
2013-11-05 21:01:09 +04:00
|
|
|
add_RunCMake_test(CMP0038)
|
2013-11-05 22:15:53 +04:00
|
|
|
add_RunCMake_test(CMP0039)
|
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-10-24 21:04:24 +04:00
|
|
|
add_RunCMake_test(CompilerNotFound)
|
2013-07-09 22:35:49 +04:00
|
|
|
add_RunCMake_test(Configure)
|
2013-10-18 19:54:09 +04:00
|
|
|
add_RunCMake_test(DisallowedCommands)
|
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)
|
2013-05-18 14:12:18 +04: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 15:46:26 +04:00
|
|
|
endif()
|
2013-01-19 14:21:14 +04:00
|
|
|
add_RunCMake_test(CompatibleInterface)
|
2012-08-06 17:29:20 +04:00
|
|
|
add_RunCMake_test(Syntax)
|
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)
|
2013-10-18 19:25:49 +04:00
|
|
|
add_RunCMake_test(cmake_minimum_required)
|
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-09-17 20:54:34 +04:00
|
|
|
add_RunCMake_test(message)
|
2013-10-21 20:49:15 +04:00
|
|
|
add_RunCMake_test(string)
|
2013-05-15 23:19:20 +04:00
|
|
|
add_RunCMake_test(try_compile)
|
2013-06-03 17:23:25 +04:00
|
|
|
add_RunCMake_test(variable_watch)
|
2013-01-16 19:42:39 +04:00
|
|
|
add_RunCMake_test(CMP0004)
|
2013-06-28 13:25:40 +04:00
|
|
|
add_RunCMake_test(TargetPolicies)
|
2013-07-12 11:14:31 +04:00
|
|
|
add_RunCMake_test(alias_targets)
|
2012-11-02 18:47:40 +04:00
|
|
|
add_RunCMake_test(interface_library)
|
2013-10-29 13:40:09 +04:00
|
|
|
add_RunCMake_test(no_install_prefix)
|
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()
|
2013-07-04 12:00:27 +04:00
|
|
|
if (QT4_FOUND)
|
|
|
|
set(ObsoleteQtMacros_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
|
|
|
add_RunCMake_test(ObsoleteQtMacros)
|
|
|
|
endif()
|
2013-03-16 21:25:59 +04:00
|
|
|
|
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)
|
2013-07-23 01:25:21 +04:00
|
|
|
add_RunCMake_test(ExportWithoutLanguage)
|
2013-06-04 18:21:33 +04:00
|
|
|
add_RunCMake_test(target_link_libraries)
|
2013-09-20 17:10:40 +04:00
|
|
|
add_RunCMake_test(CheckModules)
|