CMake/Tests/RunCMake
Brad King 0944caaebb Tests: Fix RunCMake.CMP0037 test with Ninja 1.10
The CMP0037 OLD and WARN cases that actually use reserved target names
like `all` produce `build.ninja` files with duplicate build statements
producing the same output.  With Ninja 1.10 and above we run ninja
tools at the end of generation that require `build.ninja` to be loadable.
It is not loadable for these test cases, so skip them.
2020-01-27 13:26:40 -05:00
..
add_custom_command add_custom_command: Format files in error message in a single line 2019-09-23 23:39:07 +02:00
add_custom_target add_custom_command: Format files in error message in a single line 2019-09-23 23:39:07 +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 Ninja: Add multi-config variant 2019-12-13 10:51:46 -05:00
add_subdirectory Tests: Cover EXCLUDE_FROM_ALL OFF on sub/sub/tgt in sub/all 2019-09-30 10:34:23 -04:00
alias_targets
Android Android: Use unified toolchain in NDK r19+ 2019-07-26 14:17:07 -04:00
AndroidMK
AndroidTestUtilities
AutoExportDll Revise include order using clang-format-6.0 2019-10-01 12:26:36 -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 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 Add deprecation warnings for policies CMP0069 and below 2019-10-10 09:26: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 Tests: Fix RunCMake.CMP0037 test with Ninja 1.10 2020-01-27 13:26:40 -05:00
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 Add deprecation warnings for policies CMP0069 and below 2019-10-10 09:26:10 -04:00
CMP0069 Add deprecation warnings for policies CMP0069 and below 2019-10-10 09:26:10 -04:00
CMP0081 LINK_DIRECTORIES target property: add policy for absolute paths check. 2018-09-25 23:59:59 +10:00
CMP0102 cmMarkAsAdvancedCommand: ignore variables which don't exist in the cache 2020-01-20 15:49:29 -05:00
CommandLine trace: Add time and stack level to JSON output format 2020-01-22 09:58:52 -05:00
CommandLineTar Merge topic 'tar-zstd-compression' 2019-05-30 09:39:35 -04:00
CompatibleInterface
CompileDefinitions
CompileFeatures
CompilerChange
CompilerLauncher ObjC: Add _COMPILE_LAUNCHER support 2020-01-09 13:52:37 -05:00
CompilerNotFound
Configure VS: Fix access violation when calling Visual Studio macro 2019-09-24 17:44:28 +02:00
configure_file configure_file: canonicalize input and output path in dependencies 2018-11-19 10:11:12 -05:00
continue
CPack Merge topic 'cpack-deb-fix-description' 2020-01-27 09:27:36 -05:00
CPackCommandLine Tests: Add RunCMake.CPackCommandLine case for multi-config package 2019-11-11 14:16:48 -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
CTest Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctest 2020-01-15 15:02:56 -05:00
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 Ninja: Add multi-config variant 2019-12-13 10:51:46 -05: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 ctest_test: Add option to REPEAT tests 2019-11-07 14:21:18 -05: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 ctest: Populate CTEST_CONFIGURATION_TYPE from the -C command line when set 2019-12-09 13:10:59 -05:00
CTestResourceAllocation Merge topic 'ctest-resource-allocation-spec-message' 2019-12-28 19:03:00 -05:00
CTestTimeout CTest: Fix timeout when grandchild keeps pipes open 2020-01-14 10:29:05 -05: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 Ninja: Add multi-config variant 2019-12-13 10:51:46 -05:00
File_Generate Relax the usage of TARGET_OBJECTS generator expression 2019-04-19 13:52:50 -04:00
FileAPI Ninja: Add multi-config variant 2019-12-13 10:51:46 -05:00
FileAPIExternalSource fileapi: add some source property backtraces 2019-09-26 10:56:52 -04:00
find_dependency
find_file find_*: Use debug logging infrastructure 2019-12-19 08:09:49 -05:00
find_library find_*: Use debug logging infrastructure 2019-12-19 08:09:49 -05:00
find_package find_package: Improve debug logging output 2020-01-01 15:00:42 -05:00
find_path find_*: Use debug logging infrastructure 2019-12-19 08:09:49 -05:00
find_program find_*: Use debug logging infrastructure 2019-12-19 08:09:49 -05:00
FindBoost Merge topic 'FindBoost-1.71' 2019-09-03 09:23:48 -04:00
FindGTK2
FindLua
FindMatlab
FindOpenGL
FindPkgConfig FindPkgConfig: Allow libraries that can't be found with their full path 2019-09-16 13:02:08 -04:00
foreach foreach: Allow multiple iteration variables for ZIP_LIST mode 2019-12-07 18:03:20 +02:00
FPHSA FPHSA: detect package name mismatches 2020-01-14 17:25:49 -05:00
Framework Tests: Match file command output for older macOS (Framework test) 2019-10-27 23:48:41 +11:00
function cmFunctionCommand: Introduce CMAKE_CURRENT_FUNCTION* variables 2019-12-10 16:43:27 +02:00
GenerateExportHeader Revise include order using clang-format-6.0 2019-10-01 12:26:36 -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 VS: Add support to override VCTargetsPath through toolset 2019-10-15 13:28:45 -04:00
get_filename_component Tests: Add tests for LAST_EXT and NAME_WLE 2019-01-24 22:42:42 +05:30
get_property Ninja: Add multi-config variant 2019-12-13 10:51:46 -05: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
Graphviz Graphviz: added test suite, fixes, enhancements 2019-10-08 13:45:56 +11:00
if
IfacePaths Tests: Shorten name RunCMake.IfacePaths_{INCLUDE_DIRECTORIES => INCDIRS} 2019-10-01 10:53:39 -04:00
include
include_directories
include_external_msproject VS: Add support for .NET Standard and .NET Core 2020-01-24 09:11:05 -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 file(GET_RUNTIME_DEPENDENCIES): Tolerate empty list arguments 2020-01-22 14:34:33 -05:00
INSTALL_NAME_DIR Tests: Add tests for INSTALL_NAME_DIR 2019-11-04 19:02:16 -05: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
load_cache load_cache: Allow READ_WITH_PREFIX mode in cmake scripts 2019-11-19 14:39:00 -05: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 Refactor: Modernize cmVariableWatchCommand a little 2019-10-17 09:38:31 -04:00
message Merge topic 'message-check-types' 2019-11-04 14:11:45 -05: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 RunCMake.Ninja test for Ninja 1.10 2020-01-27 13:26:40 -05:00
NinjaMultiConfig Ninja Multi-Config: Fix bug with MacOS frameworks 2020-01-24 17:16:25 -05:00
no_install_prefix
ObjectLibrary Unity: Proper handling of object libraries 2019-12-07 15:44:38 +01:00
ObsoleteQtMacros
option option: No CMP077 warnings when both cache and local variable exists 2018-07-10 13:56:15 -04:00
ParseImplicitData replace remove and remove_directory with rm in tests 2019-11-13 18:02:18 -05: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 Multi-Ninja: Add precompile headers support 2020-01-17 23:17:35 +01:00
project project: Fix potential buffer write-past-end for version components 2019-10-26 17:50:24 +11:00
project_injected cmMakefile: Enforce explicit use of project() command 2019-05-06 10:58:10 +02:00
return
RuntimePath Ninja: Add multi-config variant 2019-12-13 10:51:46 -05: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 target_compile_options: ensure BEFORE keyword is handled in all scopes 2020-01-11 01:25:25 +01:00
target_include_directories cmTargetPropCommandBase: check keywords after parsing 2018-10-26 12:09:41 -04:00
target_link_directories Link properties: must be transitive over private dependency on static library 2019-12-09 11:29:36 -05:00
target_link_libraries target_link_libraries: Fix out-of-dir linking of a list of targets 2020-01-16 13:24:27 -05:00
target_link_options Ninja: Add multi-config variant 2019-12-13 10:51:46 -05: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 Link properties: must be transitive over private dependency on static library 2019-12-09 11:29:36 -05:00
TargetProperties Add set_property option: DEPRECATION 2020-01-02 17:11:31 -05:00
TargetPropertyGeneratorExpressions cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
TargetSources VS: Add support for per-config sources 2019-10-17 14:05:39 -04:00
test_include_dirs
ToolchainFile Restore support for include_directories() in toolchain files 2019-03-25 11:48:17 -04:00
try_compile cmCoreTryCompile::CleanupFiles now removes symlinks instead of their contents. 2019-12-26 17:39:36 +01:00
try_run Tests: fix failures with gnu mode clang on windows 2019-05-24 08:43:42 +02:00
UnityBuild Unity Build: include language in generated source file name 2020-01-14 18:48:08 +01: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 'csharp-no-valued-macros' 2020-01-27 10:03:26 -05: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 Multi-Ninja: Add precompile headers support 2020-01-17 23:17:35 +01:00
CMakeLists.txt Merge topic 'mark_as_advanced-without-cache' 2020-01-22 09:50:49 -05: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: Teach RunCMake to ignore PGI license expiry warnings 2019-11-01 09:23:03 -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``.