CMake/Tests/RunCMake
Brad King 541e681da2 Merge topic 'split-custom-command-creation'
0e1faa28cb cmMakefile: Separate custom command setup from actual creation
56c204e8eb cmMakefile: Refactor AddCustomCommandOldStyle to be delay friendly
3061dc6ac9 add_custom_command: Add tests for rejecting literal quotes in commands
e893ab94ba cmMakefile: Validate command line for all custom commands
f1e846fdde cmMakefile: Extract custom command validation method
4926ab2454 cmMakefile: Create all generated byproducts as known sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3822
2019-09-20 10:24:32 -04:00
..
add_custom_command add_custom_command: Add tests for rejecting literal quotes in commands 2019-09-17 22:52:32 +02:00
add_custom_target add_custom_command: Add tests for rejecting literal quotes in commands 2019-09-17 22:52:32 +02:00
add_dependencies
add_executable cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
add_library target_*: Allow setting INTERFACE properties of UNKNOWN IMPORTED targets 2019-07-22 10:23:39 -04: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: Use unified toolchain in NDK r19+ 2019-07-26 14:17:07 -04:00
AndroidMK LINK_OPTIONS: Add new family of properties 2018-06-06 17:22:39 +02:00
AndroidTestUtilities
AutoExportDll Windows: Prevent auto exports to be regenerated on every build 2019-09-09 15:43:15 +02: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 Makefile: Fix regression in dependencies on relative includes 2019-07-24 11:37:31 -04: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
CheckIPOSupported IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio 2018-09-17 10:53:10 -04:00
CheckModules
ClangTidy
cmake_minimum_required
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
CMP0038
CMP0039
CMP0040
CMP0041
CMP0042
CMP0043
CMP0045
CMP0046
CMP0049
CMP0050
CMP0051 Testing: Update hard-coded line numbers to [0-9]+ in some tests 2018-10-10 10:06:27 -04:00
CMP0053
CMP0054
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 AIX: Explicitly compute executable exports for both XL and GNU 2019-07-15 13:27:16 -04:00
CMP0068
CMP0069 cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
CMP0081 LINK_DIRECTORIES target property: add policy for absolute paths check. 2018-09-25 23:59:59 +10:00
CommandLine Merge topic 'remove_directory-symlink' 2019-08-30 10:38:25 -04:00
CommandLineTar Merge topic 'tar-zstd-compression' 2019-05-30 09:39:35 -04:00
CompatibleInterface
CompileDefinitions
CompileFeatures
CompilerChange
CompilerLauncher
CompilerNotFound
Configure
configure_file configure_file: canonicalize input and output path in dependencies 2018-11-19 10:11:12 -05:00
continue
CPack cpack: Add CPACK_INSTALL_CMAKE_CONFIGURATIONS variable 2019-08-30 11:02:43 -04: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
CrosscompilingEmulator Fix allocation in CROSSCOMPILING_EMULATOR evaluation 2019-07-23 08:33:31 -04: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
ctest_build ctest_build: ignore ANSI color 2019-08-22 15:53:42 -04: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 ctest: rename TRACK to GROUP 2019-08-22 13:10:18 -04:00
ctest_submit ctest_submit: Add option BUILD_ID 2019-03-22 09:37:08 -04:00
ctest_test Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
ctest_update Tests: Fix RunCMake.ctest_update test to not require GIT_EXECUTABLE 2019-06-04 12:27:32 -04:00
ctest_upload Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
CTestCommandExpandLists add_test: Add COMMAND_EXPAND_LISTS option 2019-06-07 13:14:29 -04:00
CTestCommandLine Merge topic 'ctest-json-REQUIRED_FILES' 2019-08-23 10:07:32 -04:00
CTestTimeoutAfterMatch Remove unnecessary CTEST_PROJECT_NAME variables 2018-11-20 21:43:27 +01:00
DisallowedCommands
execute_process execute_process: Add option to echo command lines 2019-04-19 13:32:08 -04:00
export Tests: add tests for export set error messages 2019-06-27 10:57:34 -04: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 file: Change REMOVE to ignore empty names 2019-05-21 09:25:32 -04:00
File_Generate Relax the usage of TARGET_OBJECTS generator expression 2019-04-19 13:52:50 -04:00
FileAPI fileapi: add backtraces for LINK_PATH and LINK_DIRECTORIES 2019-09-18 14:00:39 -04:00
FileAPIExternalSource fileapi: Add test for codemodel v2 2018-12-12 09:45:49 -05:00
find_dependency
find_file Tests: find_file restore PATH env variable after test runs 2019-07-22 17:17:02 -04:00
find_library Find: Provide global controls for the NO_[]_PATH call options 2019-06-21 11:06:39 -04:00
find_package FindPackage: Support NO_[]_PATH global call options 2019-07-22 17:17:02 -04:00
find_path Merge branch 'backport-find-no-name' into find-no-name 2019-08-28 11:19:39 -04:00
find_program Tests: Remove stray source dir modification in RunCMake.find_program 2019-07-26 09:53:25 -04:00
FindBoost Merge topic 'FindBoost-1.71' 2019-09-03 09:23:48 -04:00
FindGTK2
FindLua FindLua: Add tests for this module 2018-05-24 11:19:40 -04:00
FindMatlab
FindOpenGL
FindPkgConfig FindPkgConfig: Allow libraries that can't be found with their full path 2019-09-16 13:02:08 -04:00
foreach
FPHSA
Framework Add variable CMAKE_FRAMEWORK 2019-05-21 14:26:23 +03:00
GenerateExportHeader Clang: For MSVC ABI do not use modes older than C++14 2019-07-24 07:40:30 -04:00
GeneratorExpression AIX: Create import library for executables with exports 2019-07-16 14:15:13 -04:00
GeneratorInstance
GeneratorPlatform VS: Provide the default platform name to project code 2019-04-19 07:46:13 -04:00
GeneratorToolset cuda: Adapted tests to work with modified cuda toolset 2019-08-30 08:14:01 +02: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
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 cmInstallTargetGenerator: Add tests for the RPATH_CHANGE rule 2019-06-13 16:41:11 +02:00
interface_library INTERFACE Target: allow (PUBLIC/PRIVATE)_HEADER properties 2019-04-11 11:09:42 -04: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 list(POP_FRONT): Fix always assigning first item to output vars 2019-06-30 13:15:29 +03:00
Make cmake: Add tests for verbose output to --build mode 2019-01-28 10:01:55 -05:00
math math(EXPR): Implement ~(exp_NOT) expression as documented 2019-07-23 07:33:50 -04:00
MaxRecursionDepth cmMakefile: Impose maximum recursion limit 2019-01-23 09:52:29 -05:00
message message(): Control indentation via CMAKE_MESSAGE_INDENT 2019-07-21 10:19:30 +10:00
MetaCompileFeatures Add a test to verify meta-feature parity with granular features 2019-04-09 08:44:56 -04:00
MSVCRuntimeLibrary cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
MSVCWarningFlags MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by default 2019-04-19 12:56:49 -04:00
MultiLint
Ninja Tests: fix failures with gnu mode clang on windows 2019-05-24 08:43:42 +02:00
no_install_prefix
ObjectLibrary cmExportInstallFileGenerator: improve error message 2019-08-20 10:15:03 -04:00
ObsoleteQtMacros
option option: No CMP077 warnings when both cache and local variable exists 2018-07-10 13:56:15 -04:00
ParseImplicitData CMakeParseImplicitLinkInfo supports comma separated link lines 2019-08-28 10:39:53 -04:00
ParseImplicitIncludeInfo CMakeParseImplicitLinkInfo supports comma separated link lines 2019-08-28 10:39:53 -04:00
ParseImplicitLinkInfo CMakeParseImplicitLinkInfo supports comma separated link lines 2019-08-28 10:39:53 -04:00
PolicyScope Genex: CompilerId now can match against a list of ids. 2019-06-03 10:20:23 -04:00
PositionIndependentCode PIE link options: Update strategy to fix performance regression 2018-12-19 19:41:27 +11:00
PrecompileHeaders Precompile Headers: Add REUSE_FROM signature 2019-09-17 11:58:38 +02:00
project project: Keep leading 0 in PROJECT_VERSION components 2019-07-16 07:48:40 -04:00
project_injected cmMakefile: Enforce explicit use of project() command 2019-05-06 10:58:10 +02:00
return
RuntimePath BUILD_RPATH/INSTALL_RPATH: Add generator expression support 2019-06-25 10:55:03 -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
string string: introduce REPEAT sub-command 2019-04-15 11:06:06 -04:00
Swift Swift: disallow WIN32_EXECUTABLE properties 2019-06-03 14:05:10 -04:00
Syntax cmListFileCache: When missing ending ) print starting line instead of last one 2019-06-03 10:03:53 -04:00
target_compile_definitions target_*: Allow setting INTERFACE properties of UNKNOWN IMPORTED targets 2019-07-22 10:23:39 -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 cmExportInstallFileGenerator: improve error message 2019-08-20 10:15:03 -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 Relax the usage of TARGET_OBJECTS generator expression 2019-04-19 13:52:50 -04:00
TargetPolicies cmInstallTargetGenerator: Introduce CMP0095 2019-06-13 16:41:04 +02:00
TargetPropertyGeneratorExpressions cmake: Display error if generate step fails 2019-05-13 10:31:39 -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
ToolchainFile Restore support for include_directories() in toolchain files 2019-03-25 11:48:17 -04:00
try_compile Add deprecation warnings for policies CMP0067 and below 2019-07-01 10:21:06 -04:00
try_run Tests: fix failures with gnu mode clang on windows 2019-05-24 08:43:42 +02:00
UnityBuild Unity build: Add unit tests 2019-08-30 20:39:32 +02:00
UseSWIG FindPython*: Manage weak link for Python modules 2019-05-07 16:37:24 +02:00
variable_watch
VisibilityPreset The error message for VISIBILITY_PRESET now documents valid options. 2019-06-03 09:56:03 -04:00
VS10Project Merge topic 'unity-build' 2019-09-05 08:36:06 -04:00
VS10ProjectWinCE VS10Generator: add project properties to enable WindowsCE deployment. 2019-06-19 15:11:57 -07:00
VSSolution
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
XcodeProject Merge topic 'precompile-headers' 2019-08-29 09:38:21 -04:00
CMakeLists.txt Windows: Prevent auto exports to be regenerated on every build 2019-09-09 15:43:15 +02:00
color_warning.c ctest_build: ignore ANSI color 2019-08-22 15:53:42 -04:00
exit_code.c
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_arg.c Teach CROSSCOMPILING_EMULATOR to support arguments 2019-06-03 10:17:17 -04:00
pseudo_emulator_custom_command.c
pseudo_emulator.c
pseudo_iwyu.c
pseudo_tidy.c
README.rst RunCMake: Automatically support platform out override files 2019-06-21 11:06:39 -04:00
RunCMake.cmake Tests: Drop RunCMake workaround for AIX ld warnings about GNU atexit 2019-07-15 13:27:16 -04: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 when a specific platform expects differing stdout or stderr that
  can be done by adding a platform specific output file. These follow the
  naming convention of:
   ``<SubTest>-stdout-<platform_lower_case>.txt``
   ``<SubTest>-stderr-<platform_lower_case>.txt``

   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``.