CMake/Tests/RunCMake
Brad King c2a3a945a5 Merge topic 'install-no-imported-global'
47389c5641 install: Do not crash on imported global target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3071
2019-03-08 07:32:48 -05:00
..
add_custom_command VS: Generate a custom command only in the least dependent target 2018-04-23 13:31:28 +09:00
add_custom_target add_custom_{command,target}: Fix crash on empty expanded command 2018-05-14 11:54:27 -04:00
add_dependencies
add_executable Defer check for sources within a target until generation. 2017-10-24 08:14:47 -04:00
add_library Do not produce legacy _LIB_DEPENDS cache entries 2018-03-07 07:48:40 -05:00
add_link_options LINK_OPTIONS: Add support of "LINKER:" prefix 2018-06-06 17:22:41 +02:00
add_subdirectory Pass EXCLUDE_FROM_ALL from directory to targets 2019-01-21 11:38:24 -05:00
alias_targets add_library: Restore error on alias of non-global imported target 2018-05-10 09:57:31 -04:00
Android Android: Add support for NDK r18 2018-08-28 09:27:26 -04:00
AndroidMK LINK_OPTIONS: Add new family of properties 2018-06-06 17:22:39 +02:00
AndroidTestUtilities
AutoExportDll Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
Autogen Tests: add cases for providing Qt5Core_VERSION manually 2019-01-30 11:30:18 -05:00
build_command Add deprecation warnings for policies CMP0063 and below 2018-09-17 14:16:48 -04:00
BuildDepends GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests 2017-12-30 09:35:56 +11:00
BundleUtilities Merge branch 'master' into deployqt4-cmp0080-fix 2018-10-19 10:00:29 -04:00
Byproducts Ninja,Makefile: Add tests for handling of byproducts by clean operations 2018-09-28 11:30:32 -04:00
CacheNewline cmCacheManager: Test and document newline truncation behavior 2018-01-15 09:28:32 -05:00
CheckIPOSupported IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio 2018-09-17 10:53:10 -04:00
CheckModules CheckIncludeFiles: Honor CMAKE_REQUIRED_LIBRARIES 2018-04-18 08:09:56 -04:00
ClangTidy
cmake_minimum_required cmake_minimum_required: Tolerate unknown future arguments 2018-03-26 11:31:08 -04:00
cmake_parse_arguments cmake_parse_arguments: add KEYWORDS_MISSING_VALUES 2019-02-07 12:59:10 -05:00
CMakeRoleGlobalProperty CMAKE_ROLE: Fix value in --build for Visual Studio generators 2019-02-26 14:52:17 -05:00
CMP0004
CMP0019
CMP0022
CMP0026 Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
CMP0027
CMP0028
CMP0037 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0038 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0039 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0040 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0041 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0042 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0043 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0045 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0046 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0049 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0050 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0051 Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
CMP0053 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0054 Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
CMP0055 Add deprecation warnings for policies CMP0063 and below 2018-09-17 14:16:48 -04:00
CMP0057
CMP0059
CMP0060 Add deprecation warnings for policies CMP0063 and below 2018-09-17 14:16:48 -04:00
CMP0064 Add deprecation warnings for policies CMP0065 and below 2019-01-11 14:47:20 -05:00
CMP0065
CMP0068
CMP0069 IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio 2018-09-17 10:53:10 -04:00
CMP0081 LINK_DIRECTORIES target property: add policy for absolute paths check. 2018-09-25 23:59:59 +10:00
CommandLine cmake: Teach --build mode to support multiple targets 2019-03-05 08:55:28 -05:00
CommandLineTar
CompatibleInterface
CompileDefinitions
CompileFeatures
CompilerChange
CompilerLauncher Fortran: Add option to run the compiler through launcher tools 2017-11-21 14:44:01 -05:00
CompilerNotFound
Configure
configure_file configure_file: canonicalize input and output path in dependencies 2018-11-19 10:11:12 -05:00
continue
CPack Properties: Add CMAKE_ROLE global property 2019-01-17 09:44:29 -05:00
CPackCommandLine cpack: Better error message when generator doesn't exist. 2018-11-08 09:32:18 -05:00
CPackConfig CPack: Restore support for 0-valued version components 2018-07-27 10:01:29 -04:00
CPackInstallProperties
CPackSymlinks
Cppcheck Fail the build if cppcheck returns a non-zero exit code 2018-10-11 07:56:05 -04:00
Cpplint Update cpplint support to return 0 and mark warnings for CDash. 2017-12-01 16:23:45 -05:00
CrosscompilingEmulator CROSSCOMPILING_EMULATOR: Fix test generation for empty value 2019-01-21 09:57:25 -05:00
CSharpCustomCommand CSharp: Fix regression in VS project type selection for custom target 2018-10-31 09:13:19 -04:00
CSharpReferenceImport Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
CTest Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF" 2018-03-26 07:44:22 -04:00
ctest_build Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_cmake_error Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_configure Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_coverage Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_disabled_test Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_fixtures Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_labels_for_subprojects Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_memcheck CTest: Remove special case for Dart version <= 1 2018-11-29 00:29:13 +01:00
ctest_skipped_test Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_start Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_submit ctest_submit: Remove submit method from log output 2019-01-16 10:34:08 -05:00
ctest_test Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_upload Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
CTestCommandLine CTest: Teach --show-only= to reject unknown values 2019-01-17 12:01:07 -05:00
CTestTimeoutAfterMatch Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
DisallowedCommands
execute_process execute_process: Allow UTF-8 as a synonym for the UTF8 keyword 2017-12-27 21:56:00 +11:00
export EXPORT_PROPERTIES: Add test for an undefined property 2018-08-16 22:21:25 +10:00
ExportWithoutLanguage
ExternalData Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
ExternalProject ExternalProject: add LOG_OUTPUT_ON_FAILURE option 2018-12-21 07:52:08 +11:00
FeatureSummary
FetchContent FetchContent: Add new command FetchContent_MakeAvailable() 2019-01-26 16:49:15 +11:00
file Tests: Avoid cross-device links in CREATE_LINK test 2019-01-16 10:03:35 -05:00
File_Generate GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests 2017-12-30 09:35:56 +11:00
FileAPI fileapi: extend codemodel v2 with directory details 2018-12-12 15:12:26 -05:00
FileAPIExternalSource fileapi: Add test for codemodel v2 2018-12-12 09:45:49 -05:00
find_dependency
find_file
find_library
find_package find_package: add test coverage for CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS 2019-01-16 09:59:46 -05:00
find_path
find_program find_program: Consider CWD only for paths with separator 2018-06-14 14:28:03 -04:00
FindBoost Tests: Make RunCMake.FindBoost robust to Boost_ROOT in environment 2019-01-14 07:44:32 -05:00
FindGTK2
FindLua FindLua: Add tests for this module 2018-05-24 11:19:40 -04:00
FindMatlab FindMatlab: Matlab Runtime Compiler support 2018-04-23 10:30:49 -04:00
FindOpenGL FindOpenGL: Add policy CMP0072 to prefer GLVND for legacy GL 2017-11-17 07:17:28 -05:00
FindPkgConfig FindPkgConfig: support also > and < operators for version compares 2018-10-04 10:32:13 -04:00
foreach Tests: Add test for bad foreach inside a function 2017-11-16 11:10:05 -05:00
FPHSA FPHSA: fix typo in comment 2017-09-14 08:21:38 -04:00
Framework macOS: Restore compatibility for setting FRAMEWORK after install() 2019-01-30 08:00:06 -05:00
GenerateExportHeader Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
GeneratorExpression genex: Fix erroneous handling of recursion for $<GENEX_EVAL:> 2019-02-13 08:37:02 -05:00
GeneratorInstance VS: Select and save a VS 2017 instance persistently 2017-10-19 10:20:12 -04:00
GeneratorPlatform VS: Add Visual Studio 16 2019 generator 2019-01-11 11:04:51 -05:00
GeneratorToolset VS: Teach VS 2019 generator to select host tools matching host arch 2019-01-28 12:58:21 -05:00
get_filename_component Tests: Add tests for LAST_EXT and NAME_WLE 2019-01-24 22:42:42 +05:30
get_property Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
GetPrerequisites GetPrerequisites: Fix handling of executable scripts 2019-01-05 09:09:39 +11:00
GNUInstallDirs GNUInstallDirs: Update FreeBSD "info" destination to share/info 2018-11-13 13:35:50 -05:00
GoogleTest Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
if
IfacePaths Add deprecation warnings for policies CMP0054 and below 2017-11-01 11:46:53 -04:00
include
include_directories
include_external_msproject VS: Add Visual Studio 16 2019 generator 2019-01-11 11:04:51 -05:00
include_guard Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
IncludeWhatYouUse
IncompatibleQt
install install: Do not crash on imported global target 2019-03-07 09:00:56 -05:00
interface_library CUDA: Add cu as default source file extension 2018-01-08 16:16:52 -05:00
Languages CUDA: Fix crash on linking to a CUDA target without CUDA enabled 2018-12-05 14:45:19 -05:00
LinkStatic static library: add property STATIC_LIBRARY_OPTIONS 2018-08-15 15:20:18 +02:00
LinkWhatYouUse
list Help: Clarify ordering of list(REMOVE_DUPLICATES) 2019-02-27 11:22:57 -05:00
Make cmake: Add tests for verbose output to --build mode 2019-01-28 10:01:55 -05:00
math math: Restore toleration of unexpected characters in an expression 2018-07-16 14:46:43 -04:00
MaxRecursionDepth cmMakefile: Impose maximum recursion limit 2019-01-23 09:52:29 -05:00
message Fix trivial typos in text 2017-11-03 10:25:05 -04:00
MultiLint cmcmd: Restore support for running multiple lint tools 2017-10-27 09:26:50 -04:00
Ninja cmake: Add tests for verbose output to --build mode 2019-01-28 10:01:55 -05:00
no_install_prefix
ObjectLibrary target_link_libraries: Propagate dependencies of object libraries 2018-12-10 14:57:28 -05:00
ObsoleteQtMacros
option option: No CMP077 warnings when both cache and local variable exists 2018-07-10 13:56:15 -04:00
ParseImplicitIncludeInfo XLClang: Extract compiler implicit include directories 2019-02-25 08:24:28 -05:00
PolicyScope
PositionIndependentCode PIE link options: Update strategy to fix performance regression 2018-12-19 19:41:27 +11:00
project project(): Add tests verifying variables set by second project() call 2018-10-08 08:28:01 +11:00
project_injected project: Do not issue CMP0048 warnings on injected call 2018-07-24 13:14:10 -04:00
return
RuntimePath RPATH: Add option for using $ORIGIN in build tree 2018-10-26 09:25:51 -04:00
ScriptMode set_directory_properties: Restore in script mode 2018-10-29 11:37:32 -04:00
separate_arguments
set set: warn of extra arguments after ENV value. 2019-02-01 06:10:34 -05:00
set_property Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
SourceProperties sourceFile properties: add property INCLUDE_DIRECTORIES 2018-01-24 15:10:10 +01:00
string Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
Swift
Syntax CMP0053: document that $ is a valid literal variable character 2018-10-15 13:59:39 -04:00
target_compile_definitions cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_compile_features cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_compile_options cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_include_directories cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_link_directories cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_link_libraries Tests: add tests for empty-value keyword arguments in target_* 2018-10-26 12:08:05 -04:00
target_link_options cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_sources cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
TargetObjects
TargetPolicies POSITION_INDEPENDENT_CODE: Manage link flags for executables 2018-11-11 17:34:09 +01:00
TargetPropertyGeneratorExpressions Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
TargetSources Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
test_include_dirs GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests 2017-12-30 09:35:56 +11:00
ToolchainFile
try_compile Add deprecation warnings for policies CMP0066 and below 2019-02-21 11:02:46 -05:00
try_run Tests: Teach tests when to treat clang-cl as MSVC 2019-02-11 15:04:28 +01:00
UseSWIG UseSWIG: add management of SWIG option -module 2018-12-07 18:51:57 +01:00
variable_watch variable_watch: trigger on variables set via PARENT_SCOPE 2018-04-11 15:02:07 -04:00
VisibilityPreset Add deprecation warnings for policies CMP0063 and below 2018-09-17 14:16:48 -04:00
VS10Project VS: Fix nowarn compiler option to accept warning numbers. 2019-02-07 06:39:45 -05:00
VS10ProjectWinCE VS: support suppressing deployment of selected targets 2019-02-25 09:14:15 -05:00
VSSolution VS: Add SolutionGuid to generated .sln files 2017-07-11 10:41:28 -04:00
while
WorkingDirectory Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
WriteBasicConfigVersionFile CMakePackageConfigHelpers: Add ARCH_INDEPENDENT option 2018-11-30 22:52:40 -08:00
WriteCompilerDetectionHeader WCDH: introduce BARE_FEATURES 2018-04-03 20:56:28 +02:00
XcodeProject iOS: Add IOS variable 2019-03-05 09:42:41 -05:00
CMakeLists.txt Tests: Restore support for CMake 3.1 through 3.6 with MSVC 2019-02-26 07:35:24 -05:00
exit_code.c execute_process: Add option to get results of every child 2017-06-10 08:03:06 -04:00
FileAPIDummyFile.cmake fileapi: Add test for cmakeFiles v1 2018-12-12 13:02:31 -05:00
print_stdin.c CTest: Restore inheritance of stdin by test processes 2018-11-15 08:08:56 -05:00
pseudo_cppcheck.c Fail the build if cppcheck returns a non-zero exit code 2018-10-11 07:56:05 -04:00
pseudo_cpplint.c
pseudo_emulator_custom_command.c
pseudo_emulator.c
pseudo_iwyu.c
pseudo_tidy.c
README.rst Tests: Add RunCMake_TEST_FILTER environment variable 2018-12-13 18:47:13 -05:00
RunCMake.cmake Tests: Add RunCMake_TEST_FILTER environment variable 2018-12-13 18:47:13 -05:00
RunCTest.cmake Tests: Teach run_ctest to handle removal of CTestConfig.cmake 2018-11-26 08:05:13 -05: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, say ``<Test>/``.

2. In ``./CMakeLists.txt`` call ``add_RunCMake_test`` and pass the
   test directory name ``<Test>``.

3. Create script ``<Test>/RunCMakeTest.cmake`` in the directory containing::

    include(RunCMake)
    run_cmake(SubTest1)
    ...
    run_cmake(SubTestN)

   where ``SubTest1`` through ``SubTestN`` are sub-test names each
   corresponding to an independent CMake run and project configuration.

   One may also add calls of the form::

    run_cmake_command(SubTestI ${CMAKE_COMMAND} ...)

   to fully customize the test case command-line.

   Alternatively, if the test is to cover running ``ctest -S`` then use::

    include(RunCTest)
    run_ctest(SubTest1)
    ...
    run_ctest(SubTestN)

   and create ``test.cmake.in``, ``CTestConfig.cmake.in``, and
   ``CMakeLists.txt.in`` files to be configured for each case.

4. Create file ``<Test>/CMakeLists.txt`` 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.

5. Create a ``<Test>/<SubTest>.cmake`` file for each sub-test named
   above containing the actual test code.  Optionally create files
   containing expected test results:

   ``<SubTest>-result.txt``
    Regex matching expected process result, if not ``0``
   ``<SubTest>-stdout.txt``
    Regex matching expected stdout content
   ``<SubTest>-stderr.txt``
    Regex matching expected stderr content, if not ``^$``
   ``<SubTest>-check.cmake``
    Custom result check.

   Note that trailing newlines will be stripped from actual and expected
   test output before matching against the stdout and stderr expressions.
   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``.

To speed up local testing, you can choose to run only a subset of
``run_cmake()`` tests in a ``RunCMakeTest.cmake`` script by using the
``RunCMake_TEST_FILTER`` environment variable. If this variable is set,
it is treated as a regular expression, and any tests whose names don't
match the regular expression are not run. For example::

  $ RunCMake_TEST_FILTER="^example" ctest -R '^RunCMake\.Example$'

This will only run subtests in ``RunCMake.Example`` that start with
``example``.