CMake/Tests/RunCMake
Stephen Kelly d6a03b475e cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create
backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop
execution context in favor of a new way to create backtraces.

However, a call to cmMakefile::GetExecutionContext is still invoked to
issue a contextual CMP0054 warning through cmConditionEvaluator.  As
the elseif is not part of the call stack, this resulted in trying to
access an empty vector.

Avoid the attempt at getting execution context when evaluating elseif by
constructing a context and backtrace on behalf of the cmConditionEvaluator
in all cases.
2015-10-20 23:40:12 +02:00
..
AutoExportDll Windows: Optionally generate DLL module definition files automatically 2015-07-06 11:11:02 -04:00
BuildDepends Tests: Fix RunCMake.BuildDepends filesystem delay for Borland Makefiles 2015-09-25 09:10:37 -04:00
CMP0004 Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
CMP0019 cmMakefile: Remove special handling of LINK_DIRECTORIES property. 2015-07-18 13:56:48 +02:00
CMP0022 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0026 CMP0026: Use compatibility codepath until configure is finished (#15748) 2015-09-18 20:49:00 +02:00
CMP0027 Record more policies on targets when created 2014-03-06 11:05:47 -05:00
CMP0028 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0037 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0038 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0039 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0040 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0041 Tests: Fix failures when running under the default install prefix (#15566) 2015-05-14 10:07:37 -04:00
CMP0042 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0043 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0045 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0046 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0049 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0050 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0051 cmTarget: Evaluate CMP0026 and CMP0051 in calling context 2014-05-09 11:24:15 -04:00
CMP0053 tests: test CMP0053 in WARN mode when watching variables 2014-05-22 11:13:29 -04:00
CMP0054 cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802) 2015-10-20 23:40:12 +02:00
CMP0055 RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
CMP0057 if: Implement new IN_LIST operator 2015-04-30 10:21:19 -04:00
CMP0059 Do not treat DEFINITIONS as a built-in directory property 2015-04-02 13:00:48 -04:00
CMP0060 Link libraries by full path even in implicit directories 2015-04-09 11:29:18 -04:00
CMP0064 CMP0064: Fix recorded version of introduction to be 3.4 2015-09-21 10:05:02 -04:00
CMP0065 CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK_<LANG>_FLAGS 2015-09-21 10:12:13 -04:00
COMPILE_LANGUAGE-genex Genex: Allow COMPILE_LANGUAGE when processing include directories. 2015-03-09 20:49:17 +01:00
CPack Tests: Fix RunCMake.CPack_* tests to use proper CMake generator 2015-10-01 09:48:04 -04:00
CPackConfig Introduction of CPACK_VERBATIM_VARIABLES variable 2015-09-20 23:39:03 +02:00
CPackInstallProperties Add an "installed file" property scope 2014-05-28 12:28:18 -04:00
CPackSymlinks Tests: Add case for CPack source package with symlinks 2015-04-06 08:52:54 -04:00
CTest Tests: Fix RunCMake.CTest to tolerate source line number changes 2015-04-27 10:46:52 -04:00
CTestCommandLine CTest: Add options to limit output of passed and failed tests 2015-09-18 11:32:06 -04:00
CheckModules RunCMake: Expect empty output by default. 2014-12-31 16:34:34 +01:00
CommandLine Tests: Add case for -Wdev and -Wno-dev with non-message() warnings (#15747) 2015-09-25 16:21:17 -04:00
CommandLineTar Tests: Consolidate, refactor and extend -E tar tests 2015-04-10 08:32:32 -04:00
CompatibleInterface cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup 2014-07-07 08:52:42 -04:00
CompileDefinitions CompileDefinitions: Add unit test for setting empty content. 2015-07-22 21:23:49 +02:00
CompileFeatures Project: Determine default language dialect for the compiler. 2015-09-18 10:00:21 -04:00
CompilerChange Drop use of configure_file IMMEDIATE option 2013-11-13 10:12:17 -05:00
CompilerLauncher Add options to launch the compiler through tools like ccache or distcc 2015-06-15 09:36:48 -04:00
CompilerNotFound nmake/jom: Only warn about bad VS environment if compiler not found. 2015-08-06 17:32:43 +00:00
Configure cmTarget: Do not mistake a preceding error for a CMP0049 failure 2014-07-30 13:48:33 -04:00
CrosscompilingEmulator TestGenerator: Add CROSSCOMPILING_EMULATOR support. 2015-04-08 09:06:22 -04:00
DisallowedCommands RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
ExportWithoutLanguage export(): Process the export() command at generate time. 2013-10-11 12:46:10 +02:00
ExternalData ExternalData: Add option to recursively match under directories 2015-03-27 14:44:54 -04:00
ExternalProject ExternalProject: Added new USES_TERMINAL options 2015-07-06 14:51:40 -04:00
FPHSA RunCMake: Expect empty output by default. 2014-12-31 16:34:34 +01:00
FeatureSummary FeatureSummary: Print each feature info only once 2015-02-23 11:39:17 -05:00
File_Generate File(GENERATE): Process genex evaluation files for each language. 2015-03-09 20:49:17 +01:00
FindMatlab FindMatlab: fix reconfiguration of Matlab_ROOT_DIR 2015-06-01 09:24:06 -04:00
FindPkgConfig FindPkgConfig: add a command to query arbitrary variables 2015-09-21 09:39:26 -04:00
GNUInstallDirs GNUInstallDirs: Add special cases for certain prefixes 2015-06-18 08:59:34 -04:00
GeneratorExpression Genex: Add a SHELL_PATH expression 2015-09-28 10:37:33 -04:00
GeneratorPlatform Tests: Test setting a generator platform in a toolchain file 2014-09-15 10:27:00 -04:00
GeneratorToolset VS14: Add Visual Studio 14 generator (#14982) 2014-06-25 14:51:19 -04:00
IfacePaths Tests: Fix failures when running under the default install prefix (#15566) 2015-05-14 10:07:37 -04:00
IncludeWhatYouUse Makefile: Fix <LANG>_INCLUDE_WHAT_YOU_USE with CTEST_USE_LAUNCHERS 2015-05-22 08:44:46 -04:00
IncompatibleQt Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
Languages enable_language: Allow CMakeDetermine<LANG>Compiler module to fail early 2015-06-29 16:18:32 -04:00
LinkStatic Tests: Move LINK_SEARCH_{START,END}_STATIC case to dedicated test 2015-09-02 16:11:29 -04:00
Make Tests: Add test for TARGET_MESSAGES global property 2015-07-14 13:58:53 -04:00
Ninja Ninja: Add policy to require explicit custom command byproducts 2015-03-20 17:40:12 -04:00
ObjectLibrary add_library: Allow arbitrary non-linked sources in OBJECT libraries 2014-07-09 09:43:42 -04:00
ObsoleteQtMacros Qt4Macros: Port to use message(DEPRECATION) 2013-10-08 18:23:42 +02:00
PolicyScope Tests: Verify generate-time policy scope behavior. 2015-08-01 07:18:21 +02:00
PositionIndependentCode cmTarget: Report origin of COMPATIBLE_INTERFACE properties. 2013-12-08 07:03:29 +01:00
SolutionGlobalSections Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
Swift Swift: Remove positive Swift language tests 2015-09-06 18:14:35 +02:00
Syntax cmMakefile: Create a scoped context for parsing listfiles. 2015-07-06 11:22:41 -04:00
TargetObjects Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970) 2014-07-14 09:09:32 -04:00
TargetPolicies CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK_<LANG>_FLAGS 2015-09-21 10:12:13 -04:00
TargetPropertyGeneratorExpressions Tests: Don't rely on ordering of targets in maps. 2015-05-17 11:19:20 +02:00
TargetSources Allow export of targets with INTERFACE_SOURCES. 2015-02-11 00:51:34 +01:00
VisibilityPreset Honor visibility properties for all target types (#15556) 2015-05-26 09:03:16 -04:00
WriteCompilerDetectionHeader WCDH: Make it possible to generate multiple files. 2014-11-24 21:54:41 +01:00
XcodeProject Merge topic 'fix-ios-install' 2015-09-01 09:53:30 -04:00
add_custom_command Add an option for explicit BYPRODUCTS of custom commands (#14963) 2014-11-14 16:16:00 -05:00
add_custom_target Add an option for explicit BYPRODUCTS of custom commands (#14963) 2014-11-14 16:16:00 -05:00
add_dependencies Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
add_subdirectory add_subdirectory: Fix error message on missing CMakeLists.txt (#15680) 2015-08-04 16:40:13 -04:00
alias_targets Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
build_command CTest: Stop telling 'make' to ignore errors with -i 2015-05-12 09:06:49 -04:00
cmake_minimum_required Drop compatibility with CMake < 2.4 2013-10-23 08:54:31 -04:00
configure_file Tests: Add more signature tests to RunCMake.configure_file test 2015-03-09 09:17:59 -04:00
continue continue: Add a new CMake language command for loop continuation (#14013) 2014-12-01 09:50:49 -05:00
ctest_build CTest: Optionally add a ChangeId attribute on XML Site tags 2015-07-17 10:26:28 -04:00
ctest_configure ctest_configure: Add QUIET option 2015-02-23 10:01:59 -05:00
ctest_coverage ctest_coverage: Add QUIET option 2015-02-23 10:02:00 -05:00
ctest_memcheck Tests: Guard more CTest tests against parallel execution. 2015-04-27 22:03:40 +02:00
ctest_start Tests: Move CTestTestConfigFileInBuildDir into RunCMake.ctest_start 2015-07-14 09:32:53 -04:00
ctest_submit CTest: Drop "Error in read script" message at end of testing 2015-02-27 10:31:02 -05:00
ctest_test CTest: Document and test custom output size settings 2015-09-18 11:32:05 -04:00
ctest_upload ctest_upload: Add QUIET option 2015-02-23 10:02:00 -05:00
execute_process execute_process: Improve stdout/stderr merging 2015-05-07 14:40:38 -04:00
export export: Reject custom target exports earlier (#15657) 2015-07-21 14:39:10 -04:00
file file: Teach GLOB to list directories optionally 2015-03-20 09:45:25 -04:00
find_dependency Tests: Check find_dependency empty extra arguments 2014-03-13 15:57:03 -04:00
find_file Teach find_(library|file|path) to get prefixes from PATH (#15370) 2015-02-19 10:03:17 -05:00
find_library Teach find_(library|file|path) to get prefixes from PATH (#15370) 2015-02-19 10:03:17 -05:00
find_package Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
find_path Teach find_(library|file|path) to get prefixes from PATH (#15370) 2015-02-19 10:03:17 -05:00
find_program Tests: Cover find_program when the environment duplicate some HINTS 2015-09-15 08:53:06 -04:00
get_filename_component get_filename_component: Teach new BASE_DIR parameter. 2015-08-17 23:55:38 -04:00
get_property Add SOURCE_DIR and BINARY_DIR target properties 2015-07-21 14:19:35 -04:00
if if: Add "TEST <test>" condition 2015-08-03 09:22:25 -04:00
include Policies: omit warnings about unset policies when they are actually set to NEW 2014-03-31 09:45:10 -04:00
include_directories include_directories: Fix regression in BEFORE option (#15693) 2015-08-21 15:21:37 -04:00
include_external_msproject Tests: Add generator platform support 2014-09-10 11:21:50 -04:00
install install: Allow generator expressions in DIRECTORY DESTINATION 2015-09-24 09:13:03 -04:00
interface_library Allow add_dependencies() on INTERFACE libraries (#15414) 2015-03-27 16:25:09 -04:00
list Tests: Move command failure cases into RunCMake infrastructure 2015-07-14 10:25:38 -04:00
message RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
no_install_prefix RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
project RunCMake: Remove unneeded files. 2015-02-09 19:15:04 +01:00
return return: Add test for returning inside a foreach loop 2014-11-25 14:37:39 -05:00
set Merge branch 'parent-scope-tests' into variable-pull-failure 2014-10-24 13:34:30 -04:00
set_property Tests: Cover set_property for buildsystem directory properties 2015-09-11 19:13:25 +02:00
string string: add APPEND subcommand 2015-07-07 09:23:21 -04:00
target_compile_features Features: Extend concept to C language. 2014-05-15 00:15:18 +02:00
target_link_libraries cmComputeLinkInformation: Lookup a target only if we have one 2015-08-13 10:24:10 -04:00
try_compile Merge topic 'test-rerun-cmake' 2015-01-27 11:22:06 -05:00
try_run try_run: Add test for bad link libraries. 2015-01-26 10:05:30 -05:00
variable_watch Cygwin: Avoid legacy warnings in RunCMake.* tests 2013-08-13 09:50:15 -04:00
while Tests: Move command failure cases into RunCMake infrastructure 2015-07-14 10:25:38 -04:00
CMakeLists.txt CPack: allow packaging of empty directories 2015-09-29 01:18:18 +02:00
README.rst Tests: Split RunCTest helper out of RunCMake.CTest(Submit|Memcheck) 2015-02-19 11:26:44 -05:00
RunCMake.cmake Tests: Teach RunCMake infrastructure to use custom check.cmake file 2015-09-17 10:21:08 -04:00
RunCTest.cmake Tests: Split RunCTest helper out of RunCMake.CTest(Submit|Memcheck) 2015-02-19 11:26:44 -05:00
pseudo_emulator.c Properties: Add CROSSCOMPILING_EMULATOR target property. 2015-04-07 13:33:34 -04:00
pseudo_iwyu.c Add options to run include-what-you-use with the compiler 2015-05-19 13:16:29 -04:00

README.rst

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``
    Process result expected 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``.