2014-01-20 22:44:27 +04:00
|
|
|
# See adjacent README.rst for documentation of this test infrastructure.
|
2012-03-10 01:24:43 +04:00
|
|
|
|
|
|
|
macro(add_RunCMake_test test)
|
2015-02-09 10:39:18 +03:00
|
|
|
set(TEST_ARGS ${ARGN})
|
|
|
|
if ("${ARGV1}" STREQUAL "TEST_DIR")
|
|
|
|
if ("${ARGV2}" STREQUAL "")
|
|
|
|
message(FATAL_ERROR "Invalid args")
|
|
|
|
endif()
|
|
|
|
set(Test_Dir ${ARGV2})
|
|
|
|
list(REMOVE_AT TEST_ARGS 0)
|
|
|
|
list(REMOVE_AT TEST_ARGS 0)
|
|
|
|
else()
|
|
|
|
set(Test_Dir ${test})
|
|
|
|
endif()
|
2014-12-16 00:44:59 +03:00
|
|
|
add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
|
2012-03-10 01:24:43 +04:00
|
|
|
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
|
2014-03-03 23:06:34 +04:00
|
|
|
-DRunCMake_GENERATOR=${CMAKE_GENERATOR}
|
2014-09-05 23:40:01 +04:00
|
|
|
-DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
2014-03-03 23:06:34 +04:00
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
|
2015-01-24 15:08:12 +03:00
|
|
|
-DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
|
2015-02-09 10:39:18 +03:00
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}
|
2012-03-10 01:24:43 +04:00
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
|
2012-12-20 19:16:57 +04:00
|
|
|
${${test}_ARGS}
|
2015-02-09 10:39:18 +03:00
|
|
|
${TEST_ARGS}
|
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake"
|
2012-03-10 01:24:43 +04:00
|
|
|
)
|
|
|
|
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()
|
|
|
|
|
2014-06-06 18:01:07 +04:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
|
|
|
|
set(TargetSources_ARGS -DXCODE_BELOW_2=1)
|
2014-07-17 17:31:53 +04:00
|
|
|
set(File_Generate_ARGS -DXCODE_BELOW_2=1)
|
2014-06-06 18:01:07 +04:00
|
|
|
endif()
|
|
|
|
|
2014-07-25 00:18:21 +04:00
|
|
|
# Test MSVC for older host CMake versions, and test
|
|
|
|
# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
|
|
|
|
if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
|
|
|
|
set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=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-11-20 12:53:06 +04:00
|
|
|
add_RunCMake_test(CMP0040)
|
2013-11-26 14:24:47 +04:00
|
|
|
add_RunCMake_test(CMP0041)
|
2013-12-19 08:25:29 +04:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
|
|
|
add_RunCMake_test(CMP0042)
|
|
|
|
endif()
|
2013-12-30 16:33:02 +04:00
|
|
|
add_RunCMake_test(CMP0043)
|
2014-01-08 16:16:33 +04:00
|
|
|
add_RunCMake_test(CMP0045)
|
2014-01-12 15:58:04 +04:00
|
|
|
add_RunCMake_test(CMP0046)
|
2014-02-11 20:41:24 +04:00
|
|
|
add_RunCMake_test(CMP0049)
|
2014-02-11 21:39:55 +04:00
|
|
|
add_RunCMake_test(CMP0050)
|
2014-03-18 19:15:15 +04:00
|
|
|
add_RunCMake_test(CMP0051)
|
2014-05-21 01:00:28 +04:00
|
|
|
add_RunCMake_test(CMP0053)
|
2014-09-04 22:21:28 +04:00
|
|
|
add_RunCMake_test(CMP0054)
|
2014-11-18 18:34:32 +03:00
|
|
|
add_RunCMake_test(CMP0055)
|
2015-04-29 18:25:13 +03:00
|
|
|
add_RunCMake_test(CMP0057)
|
2015-04-01 21:53:31 +03:00
|
|
|
add_RunCMake_test(CMP0059)
|
2015-04-07 17:43:47 +03:00
|
|
|
add_RunCMake_test(CMP0060)
|
2015-03-20 23:43:21 +03:00
|
|
|
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
|
|
|
add_RunCMake_test(Ninja)
|
|
|
|
endif()
|
2013-03-13 02:20:01 +04:00
|
|
|
add_RunCMake_test(CTest)
|
2014-12-16 21:50:30 +03:00
|
|
|
|
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
2015-02-19 19:35:51 +03:00
|
|
|
add_RunCMake_test(ctest_memcheck
|
2014-12-16 21:50:30 +03:00
|
|
|
-DPSEUDO_BC=$<TARGET_FILE:pseudo_BC>
|
|
|
|
-DPSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify>
|
|
|
|
-DPSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind>
|
|
|
|
-DPSEUDO_BC_NOLOG=$<TARGET_FILE:pseudonl_BC>
|
|
|
|
-DPSEUDO_PURIFY_NOLOG=$<TARGET_FILE:pseudonl_purify>
|
|
|
|
-DPSEUDO_VALGRIND_NOLOG=$<TARGET_FILE:pseudonl_valgrind>
|
|
|
|
-DMEMCHECK_FAIL=$<TARGET_FILE:memcheck_fail>
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2014-09-21 00:37:52 +04:00
|
|
|
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
|
2013-02-18 19:35:53 +04:00
|
|
|
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)
|
2014-03-03 22:51:57 +04:00
|
|
|
add_RunCMake_test(FeatureSummary)
|
2013-02-22 17:44:13 +04:00
|
|
|
add_RunCMake_test(FPHSA)
|
2012-08-13 17:49:53 +04:00
|
|
|
add_RunCMake_test(GeneratorExpression)
|
2014-09-05 22:25:27 +04:00
|
|
|
add_RunCMake_test(GeneratorPlatform)
|
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)
|
2014-02-26 18:59:18 +04:00
|
|
|
add_RunCMake_test(TargetObjects)
|
2014-02-13 20:25:00 +04:00
|
|
|
add_RunCMake_test(TargetSources)
|
2014-03-11 17:36:58 +04:00
|
|
|
add_RunCMake_test(find_dependency)
|
2014-04-02 17:34:16 +04:00
|
|
|
add_RunCMake_test(CompileFeatures)
|
2013-10-21 18:59:40 +04:00
|
|
|
add_RunCMake_test(WriteCompilerDetectionHeader)
|
2012-11-05 15:46:26 +04:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_RunCMake_test(PositionIndependentCode)
|
2015-05-22 17:43:34 +03:00
|
|
|
endif()
|
|
|
|
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
|
|
add_RunCMake_test(VisibilityPreset)
|
2012-11-05 15:46:26 +04:00
|
|
|
endif()
|
2013-12-03 16:26:51 +04:00
|
|
|
if (QT4_FOUND)
|
|
|
|
set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
|
|
|
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
|
|
|
|
2014-11-13 20:46:49 +03:00
|
|
|
add_RunCMake_test(add_custom_command)
|
|
|
|
add_RunCMake_test(add_custom_target)
|
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)
|
2015-05-07 21:40:38 +03:00
|
|
|
add_RunCMake_test(execute_process)
|
2013-12-02 20:18:29 +04:00
|
|
|
add_RunCMake_test(export)
|
2013-10-18 19:25:49 +04:00
|
|
|
add_RunCMake_test(cmake_minimum_required)
|
2014-11-29 19:56:18 +03:00
|
|
|
add_RunCMake_test(continue)
|
2015-02-17 21:41:40 +03:00
|
|
|
add_RunCMake_test(ctest_build)
|
2015-02-17 20:38:52 +03:00
|
|
|
add_RunCMake_test(ctest_configure)
|
2015-02-17 23:57:26 +03:00
|
|
|
if(COVERAGE_COMMAND)
|
|
|
|
add_RunCMake_test(ctest_coverage -DCOVERAGE_COMMAND=${COVERAGE_COMMAND})
|
|
|
|
endif()
|
2015-02-17 17:58:25 +03:00
|
|
|
add_RunCMake_test(ctest_start)
|
2015-02-19 19:33:32 +03:00
|
|
|
add_RunCMake_test(ctest_submit)
|
2015-02-17 22:23:56 +03:00
|
|
|
add_RunCMake_test(ctest_test)
|
2015-02-18 17:15:29 +03:00
|
|
|
add_RunCMake_test(ctest_upload)
|
2014-05-20 18:42:13 +04:00
|
|
|
add_RunCMake_test(file)
|
2015-02-18 18:54:45 +03:00
|
|
|
add_RunCMake_test(find_file)
|
2014-12-08 23:12:51 +03:00
|
|
|
add_RunCMake_test(find_library)
|
2012-03-10 01:34:09 +04:00
|
|
|
add_RunCMake_test(find_package)
|
2015-02-18 18:54:45 +03:00
|
|
|
add_RunCMake_test(find_path)
|
2013-04-16 17:27:51 +04:00
|
|
|
add_RunCMake_test(get_filename_component)
|
2015-01-08 23:27:46 +03:00
|
|
|
add_RunCMake_test(get_property)
|
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)
|
2014-01-29 18:28:01 +04:00
|
|
|
add_RunCMake_test(project)
|
2014-11-18 18:34:29 +03:00
|
|
|
add_RunCMake_test(return)
|
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)
|
2015-01-23 03:13:56 +03:00
|
|
|
add_RunCMake_test(try_run)
|
2013-11-13 12:18:18 +04:00
|
|
|
add_RunCMake_test(set)
|
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)
|
2014-03-07 09:55:07 +04:00
|
|
|
add_RunCMake_test(configure_file)
|
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)
|
2014-12-16 00:46:05 +03:00
|
|
|
add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
2013-07-04 12:00:27 +04:00
|
|
|
endif()
|
2013-03-16 21:25:59 +04:00
|
|
|
|
FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables (#12926)
Use CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH
cache and environment variables to extend PKG_CONFIG_PATH before calling
pkg-config.
In each of the path in these variables it searches for lib/pkgconfig.
Then, depending on the system, it searches for
lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig (debian) or for
lib64/pkgconfig (other 64 bit unixes). If any of these path is found,
it is appended to the PKG_CONFIG_PATH enviromnent variable.
Add two new arguments to the pkg_check_module and pkg_search_module
macro, NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH. The new signature
are therefore:
pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)
pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)
By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later (in
order to keep compatibility with the previous behavior), or if
PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set, the CMAKE_PREFIX_PATH,
CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment
variables will be added to pkgconfig search path.
The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this
behavior for the cache variables and the environment variables,
respectively, similarly to the find_package() command.
2014-03-06 21:55:04 +04:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
|
add_RunCMake_test(FindPkgConfig)
|
|
|
|
endif()
|
|
|
|
|
2014-03-03 23:06:34 +04:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]")
|
2012-04-19 16:35:10 +04:00
|
|
|
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
|
|
|
|
2014-05-15 21:50:53 +04:00
|
|
|
if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3)
|
2015-02-22 21:00:11 +03:00
|
|
|
add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
|
2014-05-15 21:50:53 +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-10-13 16:25:08 +04:00
|
|
|
|
2014-04-16 19:20:15 +04:00
|
|
|
add_RunCMake_test(target_compile_features)
|
2013-09-20 17:10:40 +04:00
|
|
|
add_RunCMake_test(CheckModules)
|
2014-01-20 22:50:31 +04:00
|
|
|
add_RunCMake_test(CommandLine)
|
2015-04-07 20:40:33 +03:00
|
|
|
add_RunCMake_test(CommandLineTar)
|
2013-12-25 20:59:24 +04:00
|
|
|
|
|
|
|
add_RunCMake_test(install)
|
2014-05-15 21:12:40 +04:00
|
|
|
add_RunCMake_test(CPackInstallProperties)
|
2014-10-28 13:05:57 +03:00
|
|
|
add_RunCMake_test(ExternalProject)
|
2015-03-06 00:51:10 +03:00
|
|
|
add_RunCMake_test(CTestCommandLine)
|
2015-03-31 22:04:39 +03:00
|
|
|
# Only run this test on unix platforms that support
|
|
|
|
# symbolic links
|
|
|
|
if(UNIX)
|
|
|
|
add_RunCMake_test(CPackSymlinks)
|
|
|
|
endif()
|
2014-11-30 15:42:00 +03:00
|
|
|
|
|
|
|
set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
|
|
|
|
add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
|
2015-01-21 02:29:46 +03:00
|
|
|
|
2014-11-28 20:58:38 +03:00
|
|
|
set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES)
|
|
|
|
add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths)
|
|
|
|
|
2015-02-13 19:47:47 +03:00
|
|
|
if(RPMBUILD_EXECUTABLE)
|
2015-01-21 02:29:46 +03:00
|
|
|
add_RunCMake_test(CPackRPM)
|
|
|
|
endif()
|
2014-11-26 00:47:44 +03:00
|
|
|
|
|
|
|
add_RunCMake_test(COMPILE_LANGUAGE-genex)
|
2015-02-12 19:13:31 +03:00
|
|
|
|
|
|
|
# Matlab module related tests
|
|
|
|
if(CMake_TEST_FindMatlab)
|
|
|
|
add_RunCMake_test(FindMatlab)
|
|
|
|
endif()
|
2015-03-24 07:02:50 +03:00
|
|
|
|
|
|
|
add_executable(pseudo_emulator pseudo_emulator.c)
|
|
|
|
add_RunCMake_test(CrosscompilingEmulator
|
|
|
|
-DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>)
|
2015-04-10 19:42:49 +03:00
|
|
|
# Xcode 2.x forgets to create the output directory before linking
|
|
|
|
# the individual architectures.
|
|
|
|
if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
|
|
|
|
add_custom_command(
|
|
|
|
TARGET pseudo_emulator
|
|
|
|
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
|
|
|
|
)
|
|
|
|
endif()
|
2015-05-18 21:39:25 +03:00
|
|
|
|
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
|
|
|
add_executable(pseudo_iwyu pseudo_iwyu.c)
|
|
|
|
add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>)
|
2015-06-04 22:56:56 +03:00
|
|
|
add_RunCMake_test(CompilerLauncher)
|
2015-05-18 21:39:25 +03:00
|
|
|
endif()
|