diff options
31 files changed, 305 insertions, 32 deletions
diff --git a/.gitlab/ci/ctest_configure.cmake b/.gitlab/ci/ctest_configure.cmake index 55cad13..2682055 100644 --- a/.gitlab/ci/ctest_configure.cmake +++ b/.gitlab/ci/ctest_configure.cmake @@ -6,7 +6,7 @@ set(cmake_args -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") # Create an entry in CDash. -ctest_start(Experimental TRACK "${ctest_track}") +ctest_start("${ctest_model}" GROUP "${ctest_group}") # Gather update information. find_package(Git) diff --git a/.gitlab/ci/ctest_test_external.cmake b/.gitlab/ci/ctest_test_external.cmake index b31caa4..9e2d421 100644 --- a/.gitlab/ci/ctest_test_external.cmake +++ b/.gitlab/ci/ctest_test_external.cmake @@ -7,7 +7,7 @@ set(cmake_args -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") # Create an entry in CDash. -ctest_start(Experimental TRACK "${ctest_track}") +ctest_start("${ctest_model}" GROUP "${ctest_group}") # Gather update information. find_package(Git) diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake index 7e5a7ab..f863a27 100644 --- a/.gitlab/ci/gitlab_ci.cmake +++ b/.gitlab/ci/gitlab_ci.cmake @@ -19,6 +19,7 @@ endif () # Set the build metadata. set(CTEST_BUILD_NAME "$ENV{CI_PROJECT_NAME}-$ENV{CMAKE_CONFIGURATION}") set(CTEST_SITE "gitlab-ci") +set(ctest_model "Experimental") # Default to Release builds. if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "") @@ -45,20 +46,26 @@ if (NOT "$ENV{CMAKE_GENERATOR_TOOLSET}" STREQUAL "") set(CTEST_CMAKE_GENERATOR_TOOLSET "$ENV{CMAKE_GENERATOR_TOOLSET}") endif () -# Determine the track to submit to. -set(ctest_track "Experimental") +# Determine the group to submit to. +set(ctest_group "Experimental") if (NOT "$ENV{CI_MERGE_REQUEST_ID}" STREQUAL "") - set(ctest_track "merge-requests") + set(ctest_group "merge-requests") elseif (NOT "$ENV{CMAKE_CI_PROJECT_CONTINUOUS_BRANCH}" STREQUAL "" AND "$ENV{CMAKE_CI_PROJECT_CONTINUOUS_BRANCH}" STREQUAL "$ENV{CI_COMMIT_BRANCH}" AND NOT "$ENV{CMAKE_CI_JOB_CONTINUOUS}" STREQUAL "") + set(ctest_model "Continuous") if (NOT "$ENV{CMAKE_CI_JOB_HELP}" STREQUAL "") - set(ctest_track "Continuous Help") + set(ctest_group "Continuous Help") else() - set(ctest_track "Continuous") + set(ctest_group "Continuous") endif() + string(PREPEND CTEST_BUILD_NAME "continuous-") +elseif (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") + set(ctest_model "Nightly") + set(ctest_group "Nightly Expected") + string(PREPEND CTEST_BUILD_NAME "nightly-") elseif ("$ENV{CI_PROJECT_PATH}" STREQUAL "cmake/cmake") if ("$ENV{CI_COMMIT_REF_NAME}" STREQUAL "master") - set(ctest_track "master") + set(ctest_group "master") elseif ("$ENV{CI_COMMIT_REF_NAME}" STREQUAL "release") - set(ctest_track "release") + set(ctest_group "release") endif () endif () diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml index 1edfd97..5ee8333 100644 --- a/.gitlab/rules.yml +++ b/.gitlab/rules.yml @@ -4,6 +4,8 @@ rules: - if: '$CMAKE_CI_PACKAGE == "true"' when: never + - if: '$CMAKE_CI_NIGHTLY == "true"' + when: on_success - if: '($CMAKE_CI_PROJECT_CONTINUOUS_BRANCH != "" && $CI_COMMIT_BRANCH == $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH && $CMAKE_CI_JOB_CONTINUOUS == "true")' when: delayed start_in: 5 minutes @@ -18,6 +20,8 @@ rules: - if: '$CMAKE_CI_PACKAGE == "true"' when: never + - if: '$CMAKE_CI_NIGHTLY == "true"' + when: on_success - if: '($CMAKE_CI_PROJECT_CONTINUOUS_BRANCH != "" && $CI_COMMIT_BRANCH == $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH && $CMAKE_CI_JOB_CONTINUOUS == "true")' when: on_success - if: '$CI_MERGE_REQUEST_ID' @@ -30,6 +34,8 @@ rules: - if: '$CMAKE_CI_PACKAGE == "true"' when: never + - if: '$CMAKE_CI_NIGHTLY == "true"' + when: on_success - if: '$CI_MERGE_REQUEST_ID' when: on_success - if: '$CI_PROJECT_PATH == "cmake/cmake"' diff --git a/Help/guide/ide-integration/index.rst b/Help/guide/ide-integration/index.rst new file mode 100644 index 0000000..b1b9fc4 --- /dev/null +++ b/Help/guide/ide-integration/index.rst @@ -0,0 +1,123 @@ +IDE Integration Guide +********************* + +.. only:: html + + .. contents:: + +Introduction +============ + +Integrated development environments (IDEs) may want to integrate with CMake to +improve the development experience for CMake users. This document lays out the +recommended best practices for such integration. + +Bundling +======== + +Many IDE vendors will want to bundle a copy of CMake with their IDE. IDEs that +bundle CMake should present the user with the option of using an external CMake +installation instead of the bundled one, in case the bundled copy becomes +outdated and the user wants to use a newer version. + +While IDE vendors may be tempted to bundle different versions of CMake with +their application, such practice is not recommended. CMake has strong +guarantees of backwards compatibility, and there is no reason not to use a +newer version of CMake than what a project requires, or indeed, the very latest +version. Therefore, it is recommended that IDE vendors that bundle CMake with +their application always include the very latest patch version of CMake +available at the time of release. + +As a suggestion, IDEs may also ship a copy of the Ninja buildsystem alongside +CMake. Ninja is highly performant and well-supported on all platforms that +support CMake. IDEs that bundle Ninja should use Ninja 1.10 or later, which +contains features needed to support Fortran builds. + +Presets +======= + +CMake supports a file format called ``CMakePresets.json``, and its +user-specific counterpart, ``CMakeUserPresets.json``. This file contains +information on the various configure presets that a user may want. Each preset +may have a different compiler, build flags, etc. The details of this format are +explained in the :manual:`cmake(1)` manual. + +IDE vendors are encouraged to read and evaluate this file the same way CMake +does, and present the user with the presets listed in the file. Users should be +able to see (and possibly edit) the CMake cache variables, environment +variables, and command line options that are defined for a given preset. The +IDE should then construct the list of appropriate :manual:`cmake(1)` command +line arguments based on these settings, rather than using the ``--preset=`` +option directly. The ``--preset=`` option is intended only as a convenient +frontend for command line users, and should not be used by the IDE. + +For example, if a preset named ``ninja`` specifies ``Ninja`` as the generator +and ``${sourceDir}/build`` as the build directory, instead of running: + +.. code-block:: console + + cmake -S /path/to/source --preset=ninja + +the IDE should instead calculate the settings of the ``ninja`` preset, and then +run: + +.. code-block:: console + + cmake -S /path/to/source -B /path/to/source/build -G Ninja + +While reading, parsing, and evaluating the contents of ``CMakePresets.json`` is +straightforward, it is not trivial. In addition to the documentation, IDE +vendors may also wish to refer to the CMake source code and test cases for a +better understanding of how to implement the format. + +Configuring +=========== + +IDEs that invoke :manual:`cmake(1)` to run the configure step may wish to +receive information about the artifacts that the build will produce, as well +as the include directories, compile definitions, etc. used to build the +artifacts. Such information can be obtained by using the +:manual:`File API <cmake-file-api(7)>`. The manual page for the File API +contains more information about the API and how to invoke it. +:manual:`Server mode <cmake-server(7)>` is deprecated and should not be +used on CMake 3.14 or later. + +IDEs should avoid creating more build trees than necessary, and only create +multiple build trees if the user wishes to switch to a different compiler, +use different compile flags, etc. In particular, IDEs should NOT create +multiple single-config build trees which all have the same properties except +for a differing :variable:`CMAKE_BUILD_TYPE`, effectively creating a +multi-config environment. Instead, the :generator:`Ninja Multi-Config` +generator, in conjunction with the :manual:`File API <cmake-file-api(7)>` to +get the list of build configurations, should be used for this purpose. + +IDEs should not use the "extra generators" with Makefile or Ninja generators, +which generate IDE project files in addition to the Makefile or Ninja files. +Instead the :manual:`File API <cmake-file-api(7)>` should be used to get the +list of build artifacts. + +Building +======== + +If a Makefile or Ninja generator is used to generate the build tree, it is not +recommended to invoke ``make`` or ``ninja`` directly. Instead, it is +recommended that the IDE invoke :manual:`cmake(1)` with the ``--build`` +argument, which will in turn invoke the appropriate build tool. + +If an IDE project generator is used, such as :generator:`Xcode` or one of the +Visual Studio generators, and the IDE understands the project format used, the +IDE should read the project file and build it the same way it would otherwise. + +The :manual:`File API <cmake-file-api(7)>` can be used to obtain a list of +build configurations from the build tree, and the IDE should present this list +to the user to select a build configuration. + +Testing +======= + +:manual:`ctest(1)` supports outputting a JSON format with information about the +available tests and test configurations. IDEs which want to run CTest should +obtain this information and use it to present the user with a list of tests. + +IDEs should not invoke the ``test`` target of the generated buildsystem. +Instead, they should invoke :manual:`ctest(1)` directly. diff --git a/Help/index.rst b/Help/index.rst index 616769e..6d87f71 100644 --- a/Help/index.rst +++ b/Help/index.rst @@ -85,6 +85,7 @@ Reference Manuals /guide/user-interaction/index /guide/using-dependencies/index /guide/importing-exporting/index + /guide/ide-integration/index .. only:: html or text diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 764f61e..0f00f53 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -354,9 +354,10 @@ source and build trees and generate a buildsystem: ``cacheVariables`` - An optional map of cache variables. The key is the variable name, and the - value is either ``null``, a string representing the value of the variable - (which supports macro expansion), or an object with the following fields: + An optional map of cache variables. The key is the variable name (which + may not be an empty string), and the value is either ``null``, a string + representing the value of the variable (which supports macro expansion), + or an object with the following fields: ``type`` @@ -376,14 +377,14 @@ source and build trees and generate a buildsystem: ``environment`` - An optional map of environment variables. The key is the variable name, - and the value is either ``null`` or a string representing the value of - the variable. Each variable is set regardless of whether or not a value - was given to it by the process's environment. This field supports macro - expansion, and environment variables in this map may reference each - other, and may be listed in any order, as long as such references do not - cause a cycle (for example, if ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` - may not be ``$env{ENV_1}``.) + An optional map of environment variables. The key is the variable name + (which may not be an empty string), and the value is either ``null`` or + a string representing the value of the variable. Each variable is set + regardless of whether or not a value was given to it by the process's + environment. This field supports macro expansion, and environment + variables in this map may reference each other, and may be listed in any + order, as long as such references do not cause a cycle (for example, + if ``ENV_1`` is ``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``.) Environment variables are inherited through the ``inherits`` field, and the preset's environment will be the union of its own ``environment`` and @@ -478,10 +479,11 @@ source and build trees and generate a buildsystem: ``$env{<variable-name>}`` - Environment variable with name ``<variable-name>``. If the variable is - defined in the ``environment`` field, that value is used instead of the - value from the parent environment. If the environment variable is not - defined, this evaluates as an empty string. + Environment variable with name ``<variable-name>``. The variable name may + not be an empty string. If the variable is defined in the ``environment`` + field, that value is used instead of the value from the parent environment. + If the environment variable is not defined, this evaluates as an empty + string. Note that while Windows environment variable names are case-insensitive, variable names within a preset are still case-sensitive. This may lead to diff --git a/Help/release/dev/ide-integration-guide.rst b/Help/release/dev/ide-integration-guide.rst new file mode 100644 index 0000000..f11fadd --- /dev/null +++ b/Help/release/dev/ide-integration-guide.rst @@ -0,0 +1,4 @@ +ide-integration-guide +--------------------- + +* A new guide on :guide:`IDE integration <IDE Integration Guide>` has been added. diff --git a/Help/release/dev/ispc-check-support.rst b/Help/release/dev/ispc-check-support.rst new file mode 100644 index 0000000..0023f0c --- /dev/null +++ b/Help/release/dev/ispc-check-support.rst @@ -0,0 +1,8 @@ +ispc-check-support +------------------ + +* The :module:`CheckCompilerFlag` module was extended to + support 'ISPC'. + +* The :module:`CheckSourceCompiles` module was extended to + support 'ISPC'. diff --git a/Modules/CheckCompilerFlag.cmake b/Modules/CheckCompilerFlag.cmake index 9223009..f2385d5 100644 --- a/Modules/CheckCompilerFlag.cmake +++ b/Modules/CheckCompilerFlag.cmake @@ -45,20 +45,20 @@ function(CHECK_COMPILER_FLAG _lang _flag _var) if(_lang STREQUAL C) set(_lang_src "int main(void) { return 0; }") - set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for C") + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C") elseif(_lang STREQUAL CXX) set(_lang_src "int main() { return 0; }") - set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for C\\+\\+") + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+") elseif(_lang STREQUAL Fortran) set(_lang_src " program test\n stop\n end program") - set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for Fortran") + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran") elseif(_lang STREQUAL OBJC) set(_lang_src [=[ #ifndef __OBJC__ # error "Not an Objective-C compiler" #endif int main(void) { return 0; }]=]) - set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for Objective-C" # GNU + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C" # GNU FAIL_REGEX "argument unused during compilation: .*") # Clang elseif(_lang STREQUAL OBJCXX) set(_lang_src [=[ @@ -66,8 +66,10 @@ int main(void) { return 0; }]=]) # error "Not an Objective-C++ compiler" #endif int main(void) { return 0; }]=]) - set(_lang_fail_regex FAIL_REGEX "command line option .* is valid for .* but not for Objective-C\\+\\+" # GNU + set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Objective-C\\+\\+" # GNU FAIL_REGEX "argument unused during compilation: .*") # Clang + elseif(_lang STREQUAL ISPC) + set(_lang_src "float func(uniform int32, float a) { return a / 2.25; }") else() message (SEND_ERROR "check_compiler_flag: ${_lang}: unknown language.") return() diff --git a/Modules/CheckSourceCompiles.cmake b/Modules/CheckSourceCompiles.cmake index 13ec9db..70a733d 100644 --- a/Modules/CheckSourceCompiles.cmake +++ b/Modules/CheckSourceCompiles.cmake @@ -92,6 +92,9 @@ function(CHECK_SOURCE_COMPILES _lang _source _var) elseif(_lang STREQUAL Fortran) set(_lang_textual "Fortran") set(_lang_ext "F") + elseif(_lang STREQUAL ISPC) + set(_lang_textual "ISPC") + set(_lang_ext "ispc") elseif(_lang STREQUAL OBJC) set(_lang_textual "Objective-C") set(_lang_ext "m") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d7743b3..9502460 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 18) -set(CMake_VERSION_PATCH 20201006) +set(CMake_VERSION_PATCH 20201007) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx index 25997fd..90a0faa 100644 --- a/Source/cmCMakePresetsFile.cxx +++ b/Source/cmCMakePresetsFile.cxx @@ -305,6 +305,13 @@ ReadFileResult VisitPreset(std::map<std::string, UnexpandedPreset>& presets, cycleStatus[preset.Name] = CycleStatus::InProgress; + if (preset.CacheVariables.count("") != 0) { + return ReadFileResult::INVALID_PRESET; + } + if (preset.Environment.count("") != 0) { + return ReadFileResult::INVALID_PRESET; + } + for (auto const& i : preset.Inherits) { auto parent = presets.find(i); if (parent == presets.end()) { @@ -550,7 +557,7 @@ bool ExpandMacro(const cmCMakePresetsFile& file, } } - if (macroNamespace == "env") { + if (macroNamespace == "env" && !macroName.empty()) { auto v = preset.Environment.find(macroName); if (v != preset.Environment.end() && v->second) { if (!VisitEnv(file, preset, envCycles, *v->second, @@ -563,6 +570,9 @@ bool ExpandMacro(const cmCMakePresetsFile& file, } if (macroNamespace == "env" || macroNamespace == "penv") { + if (macroName.empty()) { + return false; + } const char* value = std::getenv(macroName.c_str()); if (value) { out += value; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index cd8cbc1..557808e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -539,8 +539,11 @@ add_RunCMake_test(target_compile_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILE add_RunCMake_test(target_include_directories) add_RunCMake_test(target_sources) add_RunCMake_test(CheckCompilerFlag) -add_RunCMake_test(CheckSourceCompiles) +add_RunCMake_test(CheckSourceCompiles -DCMake_TEST_ISPC=${CMake_TEST_ISPC}) add_RunCMake_test(CheckSourceRuns) +set_property(TEST RunCMake.CheckSourceCompiles + RunCMake.CheckCompilerFlag + APPEND PROPERTY LABELS "ISPC") add_RunCMake_test(CheckModules) add_RunCMake_test(CheckIPOSupported) if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index 78e31c6..8bfc602 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -335,6 +335,22 @@ } }, { + "name": "EmptyEnv", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "MY_VAR": "$env{}" + } + }, + { + "name": "EmptyPenv", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "MY_VAR": "$penv{}" + } + }, + { "name": "UseHiddenPreset", "generator": "@RunCMake_GENERATOR@", "binaryDir": "${sourceDir}/build", diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt new file mode 100644 index 0000000..749d306 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyCacheKey: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in new file mode 100644 index 0000000..ea9c9e4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyCacheKey", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "": "value" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt new file mode 100644 index 0000000..9c9c025 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not evaluate preset "EmptyEnv": Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt new file mode 100644 index 0000000..365f537 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/EmptyEnvKey: Invalid preset$ diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in new file mode 100644 index 0000000..d87c159 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in @@ -0,0 +1,13 @@ +{ + "version": 1, + "configurePresets": [ + { + "name": "EmptyEnvKey", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "environment": { + "": "value" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt new file mode 100644 index 0000000..395c7b4 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Could not evaluate preset "EmptyPenv": Invalid macro expansion$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index f591964..4b430b3 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -90,6 +90,8 @@ run_cmake_presets(ErrorNoWarningDev) run_cmake_presets(ErrorNoWarningDeprecated) run_cmake_presets(InvalidCMakeGeneratorConfig) run_cmake_presets(UnknownCMakeGeneratorConfig) +run_cmake_presets(EmptyCacheKey) +run_cmake_presets(EmptyEnvKey) # Test cmakeMinimumRequired field run_cmake_presets(MinimumRequiredInvalid) @@ -143,6 +145,8 @@ run_cmake_presets(NoSuchMacro) run_cmake_presets(VendorMacro) run_cmake_presets(InvalidGenerator) run_cmake_presets(EnvCycle) +run_cmake_presets(EmptyEnv) +run_cmake_presets(EmptyPenv) # Test Visual Studio-specific stuff if(RunCMake_GENERATOR MATCHES "^Visual Studio ") diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake index d268ed2..095fd54 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake @@ -13,3 +13,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STR message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") endif() endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI) + if(SHOULD_FAIL_RTTI) + message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed") + endif() +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake new file mode 100644 index 0000000..662319a --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckISPCCompilerFlag.cmake @@ -0,0 +1,13 @@ + +enable_language (ISPC) +include(CheckCompilerFlag) + +check_compiler_flag(ISPC "-_this_is_not_a_flag_" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid ISPC compile flag didn't fail.") +endif() + +check_compiler_flag(ISPC "--woff" SHOULD_WORK) +if(NOT SHOULD_WORK) + message(SEND_ERROR "${CMAKE_ISPC_COMPILER_ID} compiler flag '--woff' check failed") +endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake index d56b8a9..e4d65b8 100644 --- a/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/RunCMakeTest.cmake @@ -14,3 +14,7 @@ endif() if (CMAKE_Fortran_COMPILER_ID) run_cmake(CheckFortranCompilerFlag) endif() + +if(CMake_TEST_ISPC) + run_cmake(CheckISPCCompilerFlag) +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake new file mode 100644 index 0000000..74b83c0 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckISPCSourceCompiles.cmake @@ -0,0 +1,20 @@ + +enable_language (ISPC) +include(CheckSourceCompiles) + +check_source_compiles(ISPC "I don't build" SHOULD_FAIL) +if(SHOULD_FAIL) + message(SEND_ERROR "invalid ISPC source didn't fail.") +endif() + +check_source_compiles(ISPC [=[ + +float func(uniform int32, float a) +{ + return a / 2.25; +} +]=] + SHOULD_BUILD) +if(NOT SHOULD_BUILD) + message(SEND_ERROR "Test fail for valid ISPC source.") +endif() diff --git a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake index bf32828..a574d7d 100644 --- a/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckSourceCompiles/RunCMakeTest.cmake @@ -14,3 +14,7 @@ endif() if (CMAKE_Fortran_COMPILER_ID) run_cmake(CheckFortranSourceCompiles) endif() + +if(CMake_TEST_ISPC) + run_cmake(CheckISPCSourceCompiles) +endif() |