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
|
|
|
|
2015-06-05 19:03:26 +00:00
|
|
|
function(add_RunCMake_test_group test types)
|
|
|
|
# create directory for common content
|
|
|
|
set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf")
|
|
|
|
file(REMOVE_RECURSE "${TEST_CONFIG_DIR}")
|
|
|
|
file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}")
|
|
|
|
|
|
|
|
foreach(type IN LISTS types)
|
|
|
|
# generate prerequirements config file in cmake as ctest doesn't have as
|
|
|
|
# much system information so it is easier to set programs and environment
|
|
|
|
# values here
|
|
|
|
unset(${test}_${type}_FOUND_PREREQUIREMENTS)
|
|
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake")
|
|
|
|
get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS"
|
|
|
|
"${TEST_CONFIG_DIR}/${type}_config.cmake")
|
|
|
|
|
|
|
|
# only add the test if prerequirements are met
|
|
|
|
if(${test}_${type}_FOUND_PREREQUIREMENTS)
|
|
|
|
add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND}
|
|
|
|
-DTEST_TYPE=${type}
|
|
|
|
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DRunCMake_GENERATOR=${CMAKE_GENERATOR}
|
|
|
|
-DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
|
|
|
-DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
|
|
|
|
-DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
|
|
|
|
-DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
|
|
|
|
-DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test}
|
|
|
|
-Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake
|
|
|
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
2015-07-06 20:15:49 +00:00
|
|
|
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
|
|
|
|
set(Swift_ARGS -DXCODE_BELOW_6_1=1)
|
|
|
|
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)
|
2015-04-29 15:25:13 +00:00
|
|
|
add_RunCMake_test(CMP0057)
|
2015-04-01 18:53:31 +00:00
|
|
|
add_RunCMake_test(CMP0059)
|
2015-04-07 14:43:47 +00:00
|
|
|
add_RunCMake_test(CMP0060)
|
2014-12-30 01:47:48 +00:00
|
|
|
add_RunCMake_test(CMP0064)
|
2017-02-09 15:12:10 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
|
|
|
add_RunCMake_test(CMP0068)
|
|
|
|
endif()
|
2017-03-09 13:05:19 +00:00
|
|
|
add_RunCMake_test(CMP0069)
|
2015-08-24 18:33:31 +00:00
|
|
|
|
|
|
|
# The test for Policy 65 requires the use of the
|
|
|
|
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
|
|
|
|
# generators ignore. The policy will have no effect on those generators.
|
|
|
|
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
|
|
|
|
add_RunCMake_test(CMP0065)
|
|
|
|
endif()
|
2015-07-14 17:31:21 +00:00
|
|
|
if(CMAKE_GENERATOR MATCHES "Make")
|
|
|
|
add_RunCMake_test(Make)
|
|
|
|
endif()
|
2015-03-20 20:43:21 +00:00
|
|
|
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
2017-04-17 20:24:44 +00:00
|
|
|
set(Ninja_ARGS
|
|
|
|
-DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION}
|
|
|
|
-DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}
|
|
|
|
-DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX})
|
2015-03-20 20:43:21 +00:00
|
|
|
add_RunCMake_test(Ninja)
|
|
|
|
endif()
|
2013-03-12 22:20:01 +00:00
|
|
|
add_RunCMake_test(CTest)
|
2014-12-16 18:50:30 +00:00
|
|
|
|
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
2015-02-19 16:35:51 +00:00
|
|
|
add_RunCMake_test(ctest_memcheck
|
2014-12-16 18:50:30 +00: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()
|
|
|
|
|
2016-09-15 19:31:39 +00:00
|
|
|
add_RunCMake_test(AndroidTestUtilities)
|
2015-09-16 14:09:07 +00:00
|
|
|
add_RunCMake_test(BuildDepends)
|
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)
|
2016-09-01 19:22:05 +00:00
|
|
|
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
|
|
|
|
add_RunCMake_test(GenerateExportHeader)
|
|
|
|
endif()
|
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)
|
2015-06-16 18:59:51 +00:00
|
|
|
add_RunCMake_test(GNUInstallDirs)
|
2012-09-18 11:57:07 +00:00
|
|
|
add_RunCMake_test(TargetPropertyGeneratorExpressions)
|
2012-06-20 15:04:35 +00:00
|
|
|
add_RunCMake_test(Languages)
|
2015-09-02 20:09:22 +00:00
|
|
|
add_RunCMake_test(LinkStatic)
|
2012-03-12 18:51:30 +00:00
|
|
|
add_RunCMake_test(ObjectLibrary)
|
2017-03-01 17:38:10 +00:00
|
|
|
if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
|
|
|
|
add_RunCMake_test(RuntimePath)
|
|
|
|
endif()
|
2015-07-06 20:15:49 +00:00
|
|
|
add_RunCMake_test(Swift)
|
2014-02-26 14:59:18 +00:00
|
|
|
add_RunCMake_test(TargetObjects)
|
2014-02-13 16:25:00 +00:00
|
|
|
add_RunCMake_test(TargetSources)
|
2016-03-07 18:31:25 +00:00
|
|
|
add_RunCMake_test(ToolchainFile)
|
2014-03-11 13:36:58 +00:00
|
|
|
add_RunCMake_test(find_dependency)
|
2015-07-21 20:52:44 +00:00
|
|
|
add_RunCMake_test(CompileDefinitions)
|
2014-04-02 13:34:16 +00:00
|
|
|
add_RunCMake_test(CompileFeatures)
|
2015-08-01 05:16:40 +00:00
|
|
|
add_RunCMake_test(PolicyScope)
|
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)
|
2015-05-22 14:43:34 +00:00
|
|
|
endif()
|
|
|
|
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
|
|
add_RunCMake_test(VisibilityPreset)
|
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)
|
2015-08-04 20:39:31 +00:00
|
|
|
add_RunCMake_test(add_subdirectory)
|
2012-03-09 21:47:19 +00:00
|
|
|
add_RunCMake_test(build_command)
|
2016-11-23 12:11:40 +00:00
|
|
|
if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
|
|
|
set(execute_process_ARGS -DTEST_ENCODING_EXE=$<TARGET_FILE:testEncoding>)
|
|
|
|
endif()
|
2015-05-07 18:40:38 +00:00
|
|
|
add_RunCMake_test(execute_process)
|
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)
|
2015-12-05 17:57:41 +00:00
|
|
|
add_RunCMake_test(cmake_parse_arguments)
|
2014-11-29 16:56:18 +00:00
|
|
|
add_RunCMake_test(continue)
|
2015-02-17 18:41:40 +00:00
|
|
|
add_RunCMake_test(ctest_build)
|
2016-07-28 19:12:43 +00:00
|
|
|
add_RunCMake_test(ctest_cmake_error)
|
2015-02-17 17:38:52 +00:00
|
|
|
add_RunCMake_test(ctest_configure)
|
2015-02-17 20:57:26 +00:00
|
|
|
if(COVERAGE_COMMAND)
|
|
|
|
add_RunCMake_test(ctest_coverage -DCOVERAGE_COMMAND=${COVERAGE_COMMAND})
|
|
|
|
endif()
|
2015-02-17 14:58:25 +00:00
|
|
|
add_RunCMake_test(ctest_start)
|
2015-02-19 16:33:32 +00:00
|
|
|
add_RunCMake_test(ctest_submit)
|
2015-02-17 19:23:56 +00:00
|
|
|
add_RunCMake_test(ctest_test)
|
2017-03-27 18:08:50 +00:00
|
|
|
add_RunCMake_test(ctest_disabled_test)
|
2015-02-18 14:15:29 +00:00
|
|
|
add_RunCMake_test(ctest_upload)
|
2016-09-07 04:04:07 +00:00
|
|
|
add_RunCMake_test(ctest_fixtures)
|
2014-05-20 14:42:13 +00:00
|
|
|
add_RunCMake_test(file)
|
2015-02-18 15:54:45 +00:00
|
|
|
add_RunCMake_test(find_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)
|
2015-02-18 15:54:45 +00:00
|
|
|
add_RunCMake_test(find_path)
|
2015-09-01 20:33:24 +00:00
|
|
|
add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
|
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)
|
2016-09-27 13:33:58 +00:00
|
|
|
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
|
2014-11-18 15:34:29 +00:00
|
|
|
add_RunCMake_test(return)
|
2015-07-08 17:14:37 +00:00
|
|
|
add_RunCMake_test(set_property)
|
2013-10-21 16:49:15 +00:00
|
|
|
add_RunCMake_test(string)
|
2016-12-01 19:24:02 +00:00
|
|
|
foreach(var
|
|
|
|
CMAKE_C_COMPILER_ID
|
|
|
|
CMAKE_C_COMPILER_VERSION
|
|
|
|
CMAKE_C_STANDARD_DEFAULT
|
|
|
|
CMAKE_CXX_COMPILER_ID
|
|
|
|
CMAKE_CXX_COMPILER_VERSION
|
|
|
|
CMAKE_CXX_STANDARD_DEFAULT
|
2016-12-02 21:56:12 +00:00
|
|
|
CMake_TEST_CUDA
|
2016-12-01 19:24:02 +00:00
|
|
|
)
|
|
|
|
if(DEFINED ${var})
|
|
|
|
list(APPEND try_compile_ARGS -D${var}=${${var}})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
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)
|
2015-07-14 13:41:05 +00:00
|
|
|
add_RunCMake_test(while)
|
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)
|
2016-02-18 18:59:18 +00:00
|
|
|
add_RunCMake_test(CTestTimeoutAfterMatch)
|
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()
|
|
|
|
|
2017-01-25 09:19:00 +00:00
|
|
|
find_package(GTK2 QUIET)
|
|
|
|
if (GTK2_FOUND)
|
|
|
|
add_RunCMake_test(FindGTK2)
|
|
|
|
endif()
|
|
|
|
|
2016-03-09 14:42:18 +00:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
2012-04-19 12:35:10 +00:00
|
|
|
add_RunCMake_test(include_external_msproject)
|
2017-04-19 19:00:57 +00:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([89]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND)
|
2016-03-21 20:01:20 +00:00
|
|
|
set(NO_USE_FOLDERS 1)
|
|
|
|
endif()
|
|
|
|
add_RunCMake_test(VSSolution -DNO_USE_FOLDERS=${NO_USE_FOLDERS})
|
2012-04-19 12:35:10 +00:00
|
|
|
endif()
|
2013-01-02 16:10:04 +00:00
|
|
|
|
2017-04-19 19:00:57 +00:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^89]|[89][0-9])")
|
2016-02-25 21:04:05 +00:00
|
|
|
add_RunCMake_test(VS10Project)
|
|
|
|
endif()
|
|
|
|
|
2017-04-21 16:57:11 +00:00
|
|
|
if(XCODE_VERSION)
|
2015-02-22 18:00:11 +00:00
|
|
|
add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
|
2014-05-15 17:50:53 +00:00
|
|
|
endif()
|
|
|
|
|
2016-12-26 17:01:32 +00:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
|
2015-11-13 11:59:18 +00:00
|
|
|
AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
|
|
|
|
add_RunCMake_test(Framework)
|
|
|
|
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)
|
2017-03-11 11:56:00 +00:00
|
|
|
add_RunCMake_test(CheckIPOSupported)
|
2017-02-19 17:26:44 +00:00
|
|
|
add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
|
2015-04-07 17:40:33 +00:00
|
|
|
add_RunCMake_test(CommandLineTar)
|
2013-12-25 16:59:24 +00:00
|
|
|
|
|
|
|
add_RunCMake_test(install)
|
2015-08-28 06:07:52 +00:00
|
|
|
add_RunCMake_test(CPackConfig)
|
2014-05-15 17:12:40 +00:00
|
|
|
add_RunCMake_test(CPackInstallProperties)
|
2014-10-28 10:05:57 +00:00
|
|
|
add_RunCMake_test(ExternalProject)
|
2015-03-05 21:51:10 +00:00
|
|
|
add_RunCMake_test(CTestCommandLine)
|
2015-03-31 19:04:39 +00:00
|
|
|
# Only run this test on unix platforms that support
|
|
|
|
# symbolic links
|
|
|
|
if(UNIX)
|
|
|
|
add_RunCMake_test(CPackSymlinks)
|
|
|
|
endif()
|
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
|
|
|
|
2014-11-28 17:58:38 +00:00
|
|
|
set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES)
|
|
|
|
add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths)
|
|
|
|
|
2014-11-25 21:47:44 +00:00
|
|
|
add_RunCMake_test(COMPILE_LANGUAGE-genex)
|
2015-02-12 16:13:31 +00:00
|
|
|
|
|
|
|
# Matlab module related tests
|
|
|
|
if(CMake_TEST_FindMatlab)
|
|
|
|
add_RunCMake_test(FindMatlab)
|
|
|
|
endif()
|
2015-03-24 04:02:50 +00:00
|
|
|
|
|
|
|
add_executable(pseudo_emulator pseudo_emulator.c)
|
2016-05-04 17:30:19 +00:00
|
|
|
add_executable(pseudo_emulator_custom_command pseudo_emulator_custom_command.c)
|
2015-03-24 04:02:50 +00:00
|
|
|
add_RunCMake_test(CrosscompilingEmulator
|
2016-05-04 17:30:19 +00:00
|
|
|
-DPSEUDO_EMULATOR=$<TARGET_FILE:pseudo_emulator>
|
|
|
|
-DPSEUDO_EMULATOR_CUSTOM_COMMAND=$<TARGET_FILE:pseudo_emulator_custom_command>)
|
2015-05-18 18:39:25 +00:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
2016-06-02 22:08:30 +00:00
|
|
|
if(UNIX AND NOT CYGWIN)
|
|
|
|
execute_process(COMMAND ldd --help
|
2016-07-21 19:38:47 +00:00
|
|
|
OUTPUT_VARIABLE LDD_HELP
|
|
|
|
ERROR_VARIABLE LDD_ERR)
|
2016-06-02 22:08:30 +00:00
|
|
|
if("${LDD_HELP}" MATCHES
|
|
|
|
"(-r, --function-relocs.*process data and function relocations.*-u, --unused.*print unused direct dependencies)")
|
|
|
|
add_RunCMake_test(LinkWhatYouUse)
|
|
|
|
endif()
|
|
|
|
endif()
|
2016-04-08 20:09:27 +00:00
|
|
|
add_executable(pseudo_tidy pseudo_tidy.c)
|
2015-05-18 18:39:25 +00:00
|
|
|
add_executable(pseudo_iwyu pseudo_iwyu.c)
|
2017-01-23 19:47:13 +00:00
|
|
|
add_executable(pseudo_cpplint pseudo_cpplint.c)
|
2016-04-08 20:09:27 +00:00
|
|
|
add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>)
|
2015-05-18 18:39:25 +00:00
|
|
|
add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>)
|
2017-01-23 19:47:13 +00:00
|
|
|
add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>)
|
2015-06-04 19:56:56 +00:00
|
|
|
add_RunCMake_test(CompilerLauncher)
|
2015-05-18 18:39:25 +00:00
|
|
|
endif()
|
2015-06-05 19:03:26 +00:00
|
|
|
|
2017-01-19 22:02:07 +00:00
|
|
|
add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ")
|
2015-06-19 20:12:43 +00:00
|
|
|
# add a test to make sure symbols are exported from a shared library
|
|
|
|
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
|
|
|
|
add_RunCMake_test(AutoExportDll)
|
2016-06-21 20:18:56 +00:00
|
|
|
|
2016-07-12 17:26:55 +00:00
|
|
|
add_RunCMake_test(AndroidMK)
|
|
|
|
|
2016-06-21 20:18:56 +00:00
|
|
|
if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN)
|
|
|
|
if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
|
|
|
|
message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators")
|
|
|
|
endif()
|
|
|
|
foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
|
|
|
|
if(CMake_${v})
|
|
|
|
string(REPLACE ";" "|" ${v} "${CMake_${v}}")
|
|
|
|
list(APPEND Android_ARGS "-D${v}=${${v}}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_RunCMake_test(Android)
|
|
|
|
|
|
|
|
# This test can take a very long time due to lots of combinations.
|
|
|
|
# Use a long default timeout and provide an option to customize it.
|
|
|
|
if(NOT DEFINED CMake_TEST_ANDROID_TIMEOUT)
|
|
|
|
set(CMake_TEST_ANDROID_TIMEOUT 3000)
|
|
|
|
endif()
|
|
|
|
set_property(TEST RunCMake.Android PROPERTY TIMEOUT ${CMake_TEST_ANDROID_TIMEOUT})
|
|
|
|
endif()
|