2014-01-20 18:44:27 +00:00
|
|
|
# See adjacent README.rst for documentation of this test infrastructure.
|
2012-03-09 21:24:43 +00:00
|
|
|
|
|
|
|
macro(add_RunCMake_test test)
|
2015-02-09 07:39:18 +00: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-15 21:44:59 +00:00
|
|
|
add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND}
|
2012-03-09 21:24:43 +00:00
|
|
|
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
|
2014-03-03 19:06:34 +00:00
|
|
|
-DRunCMake_GENERATOR=${CMAKE_GENERATOR}
|
2014-09-05 19:40:01 +00:00
|
|
|
-DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
2014-03-03 19:06:34 +00:00
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
|
2015-01-24 12:08:12 +00:00
|
|
|
-DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
|
2015-02-09 07:39:18 +00:00
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}
|
2012-03-09 21:24:43 +00:00
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test}
|
2012-12-20 15:16:57 +00:00
|
|
|
${${test}_ARGS}
|
2015-02-09 07:39:18 +00:00
|
|
|
${TEST_ARGS}
|
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake"
|
2012-03-09 21:24:43 +00:00
|
|
|
)
|
|
|
|
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()
|
|
|
|
|
2014-06-06 14:01:07 +00:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
|
|
|
|
set(TargetSources_ARGS -DXCODE_BELOW_2=1)
|
2014-07-17 13:31:53 +00:00
|
|
|
set(File_Generate_ARGS -DXCODE_BELOW_2=1)
|
2014-06-06 14:01:07 +00:00
|
|
|
endif()
|
|
|
|
|
2014-07-24 20:18:21 +00: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 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-11-08 16:44:55 +00:00
|
|
|
add_RunCMake_test(CMP0037)
|
2013-11-05 17:01:09 +00:00
|
|
|
add_RunCMake_test(CMP0038)
|
2013-11-05 18:15:53 +00:00
|
|
|
add_RunCMake_test(CMP0039)
|
2013-11-20 08:53:06 +00:00
|
|
|
add_RunCMake_test(CMP0040)
|
2013-11-26 10:24:47 +00:00
|
|
|
add_RunCMake_test(CMP0041)
|
2013-12-19 04:25:29 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
|
|
|
add_RunCMake_test(CMP0042)
|
|
|
|
endif()
|
2013-12-30 12:33:02 +00:00
|
|
|
add_RunCMake_test(CMP0043)
|
2014-01-08 12:16:33 +00:00
|
|
|
add_RunCMake_test(CMP0045)
|
2014-01-12 11:58:04 +00:00
|
|
|
add_RunCMake_test(CMP0046)
|
2014-02-11 16:41:24 +00:00
|
|
|
add_RunCMake_test(CMP0049)
|
2014-02-11 17:39:55 +00:00
|
|
|
add_RunCMake_test(CMP0050)
|
2014-03-18 15:15:15 +00:00
|
|
|
add_RunCMake_test(CMP0051)
|
2014-05-20 21:00:28 +00:00
|
|
|
add_RunCMake_test(CMP0053)
|
2014-09-04 18:21:28 +00:00
|
|
|
add_RunCMake_test(CMP0054)
|
2014-11-18 15:34:32 +00:00
|
|
|
add_RunCMake_test(CMP0055)
|
2013-03-12 22:20:01 +00:00
|
|
|
add_RunCMake_test(CTest)
|
2015-01-15 18:41:39 +00:00
|
|
|
add_RunCMake_test(CTestSubmit)
|
2014-12-16 18:50:30 +00:00
|
|
|
|
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
add_RunCMake_test(CTestMemcheck
|
|
|
|
-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-20 20:37:52 +00:00
|
|
|
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
|
2013-02-18 15:35:53 +00:00
|
|
|
add_RunCMake_test(CompilerChange)
|
|
|
|
endif()
|
2013-10-24 17:04:24 +00:00
|
|
|
add_RunCMake_test(CompilerNotFound)
|
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)
|
2014-03-03 18:51:57 +00:00
|
|
|
add_RunCMake_test(FeatureSummary)
|
2013-02-22 13:44:13 +00:00
|
|
|
add_RunCMake_test(FPHSA)
|
2012-08-13 13:49:53 +00:00
|
|
|
add_RunCMake_test(GeneratorExpression)
|
2014-09-05 18:25:27 +00:00
|
|
|
add_RunCMake_test(GeneratorPlatform)
|
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)
|
2014-02-26 14:59:18 +00:00
|
|
|
add_RunCMake_test(TargetObjects)
|
2014-02-13 16:25:00 +00:00
|
|
|
add_RunCMake_test(TargetSources)
|
2014-03-11 13:36:58 +00:00
|
|
|
add_RunCMake_test(find_dependency)
|
2014-04-02 13:34:16 +00:00
|
|
|
add_RunCMake_test(CompileFeatures)
|
2013-10-21 14:59:40 +00:00
|
|
|
add_RunCMake_test(WriteCompilerDetectionHeader)
|
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-12-03 12:26:51 +00:00
|
|
|
if (QT4_FOUND)
|
|
|
|
set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
|
|
|
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
|
|
|
|
2014-11-13 17:46:49 +00:00
|
|
|
add_RunCMake_test(add_custom_command)
|
|
|
|
add_RunCMake_test(add_custom_target)
|
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)
|
2013-12-02 16:18:29 +00:00
|
|
|
add_RunCMake_test(export)
|
2013-10-18 15:25:49 +00:00
|
|
|
add_RunCMake_test(cmake_minimum_required)
|
2014-11-29 16:56:18 +00:00
|
|
|
add_RunCMake_test(continue)
|
2014-05-20 14:42:13 +00:00
|
|
|
add_RunCMake_test(file)
|
2014-12-08 20:12:51 +00:00
|
|
|
add_RunCMake_test(find_library)
|
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)
|
2015-01-08 20:27:46 +00:00
|
|
|
add_RunCMake_test(get_property)
|
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)
|
2014-01-29 14:28:01 +00:00
|
|
|
add_RunCMake_test(project)
|
2014-11-18 15:34:29 +00:00
|
|
|
add_RunCMake_test(return)
|
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)
|
2015-01-23 00:13:56 +00:00
|
|
|
add_RunCMake_test(try_run)
|
2013-11-13 08:18:18 +00:00
|
|
|
add_RunCMake_test(set)
|
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)
|
2013-10-29 09:40:09 +00:00
|
|
|
add_RunCMake_test(no_install_prefix)
|
2014-03-07 05:55:07 +00:00
|
|
|
add_RunCMake_test(configure_file)
|
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)
|
2014-12-15 21:46:05 +00:00
|
|
|
add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
|
2013-07-04 08:00:27 +00:00
|
|
|
endif()
|
2013-03-16 17:25:59 +00: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 17:55:04 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
|
add_RunCMake_test(FindPkgConfig)
|
|
|
|
endif()
|
|
|
|
|
2014-03-03 19:06:34 +00:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]")
|
2012-04-19 12:35:10 +00:00
|
|
|
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
|
|
|
|
2014-05-15 17:50:53 +00:00
|
|
|
if(XCODE_VERSION AND NOT "${XCODE_VERSION}" VERSION_LESS 3)
|
|
|
|
add_RunCMake_test(XcodeProject)
|
|
|
|
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-10-13 12:25:08 +00:00
|
|
|
|
2014-04-16 15:20:15 +00:00
|
|
|
add_RunCMake_test(target_compile_features)
|
2013-09-20 13:10:40 +00:00
|
|
|
add_RunCMake_test(CheckModules)
|
2014-01-20 18:50:31 +00:00
|
|
|
add_RunCMake_test(CommandLine)
|
2013-12-25 16:59:24 +00:00
|
|
|
|
|
|
|
add_RunCMake_test(install)
|
2014-05-15 17:12:40 +00:00
|
|
|
add_RunCMake_test(CPackInstallProperties)
|
2014-10-28 10:05:57 +00:00
|
|
|
add_RunCMake_test(ExternalProject)
|
2014-11-30 12:42:00 +00:00
|
|
|
|
|
|
|
set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
|
|
|
|
add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
|
2015-01-20 23:29:46 +00:00
|
|
|
|
|
|
|
if(RPMBUILD)
|
|
|
|
add_RunCMake_test(CPackRPM)
|
|
|
|
endif()
|