summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.gitlab/ci/cmake.ps14
-rwxr-xr-x.gitlab/ci/cmake.sh6
-rw-r--r--.gitlab/ci/configure_macos_common.cmake4
-rw-r--r--.gitlab/os-macos.yml8
-rw-r--r--.gitlab/os-windows.yml8
-rw-r--r--Auxiliary/cmake-mode.el3
-rw-r--r--Help/dev/README.rst2
-rw-r--r--Help/dev/experimental.rst10
-rw-r--r--Help/manual/cmake-modules.7.rst2
-rw-r--r--Help/manual/cmake-presets.7.rst2
-rw-r--r--Help/manual/cmake-properties.7.rst4
-rw-r--r--Help/manual/ctest.1.rst10
-rw-r--r--Help/module/UseJavaClassFilelist.rst6
-rw-r--r--Help/module/UseJavaSymlinks.rst6
-rw-r--r--Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst8
-rw-r--r--Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst8
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type.rst14
-rw-r--r--Help/prop_tgt/XCODE_EMBED_type_PATH.rst9
-rw-r--r--Help/release/3.19.rst18
-rw-r--r--Help/release/dev/xcode-embed-frameworks.rst9
-rw-r--r--Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_POST_TEST.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_PRE_TEST.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst2
-rw-r--r--Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst2
-rw-r--r--Help/variable/CTEST_MEMORYCHECK_TYPE.rst2
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake10
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake12
-rw-r--r--Modules/CTest.cmake17
-rw-r--r--Modules/CheckPIESupported.cmake8
-rw-r--r--Modules/Compiler/AppleClang-C.cmake2
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake2
-rw-r--r--Modules/Compiler/Clang-C.cmake2
-rw-r--r--Modules/Compiler/Clang-CXX.cmake2
-rw-r--r--Modules/Compiler/GNU-C.cmake2
-rw-r--r--Modules/Compiler/GNU-CXX.cmake2
-rw-r--r--Modules/Compiler/GNU.cmake1
-rw-r--r--Modules/Compiler/Intel-C.cmake2
-rw-r--r--Modules/Compiler/Intel-CXX.cmake2
-rw-r--r--Modules/Compiler/XL-C.cmake2
-rw-r--r--Modules/Compiler/XL-CXX.cmake5
-rw-r--r--Modules/Compiler/XLClang-C.cmake2
-rw-r--r--Modules/Compiler/XLClang-CXX.cmake2
-rw-r--r--Modules/DartConfiguration.tcl.in4
-rw-r--r--Modules/FindGTest.cmake38
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake9
-rw-r--r--Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake (renamed from Modules/Internal/CMakeCheckCompilerFlag.cmake)6
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake14
-rw-r--r--Modules/Internal/CheckSourceCompiles.cmake14
-rw-r--r--Modules/Internal/CheckSourceRuns.cmake12
-rw-r--r--Source/CMakeLists.txt10
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx30
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.h2
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx7
-rw-r--r--Source/cmFileTime.cxx15
-rw-r--r--Source/cmFileTime.h52
-rw-r--r--Source/cmGlobalGenerator.cxx9
-rw-r--r--Source/cmGlobalGenerator.h11
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx135
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx156
-rw-r--r--Source/cmGlobalXCodeGenerator.h8
-rw-r--r--Source/cmMakefileTargetGenerator.cxx23
-rw-r--r--Source/cmNinjaTargetGenerator.cxx13
-rw-r--r--Source/cmScanDepFormat.cxx267
-rw-r--r--Source/cmScanDepFormat.h30
-rw-r--r--Source/cmTarget.cxx56
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
-rw-r--r--Source/cmXCodeObject.h7
-rw-r--r--Source/cmake.cxx908
-rw-r--r--Source/cmcmd.cxx2
-rw-r--r--Tests/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-Common.cmake5
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt14
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt20
-rw-r--r--Tests/RunCMake/CMP0111/main.cpp3
-rw-r--r--Tests/RunCMake/CMP0111/module.cpp4
-rw-r--r--Tests/RunCMake/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt3
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake2
-rw-r--r--Tests/RunCMake/CommandLine/C-no-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/D-no-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/U-no-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt2
-rw-r--r--Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake5
-rw-r--r--Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/RunCMake.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake7
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake7
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake3
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake14
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake8
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake43
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/func.m6
-rw-r--r--Tests/RunCMake/XcodeProject-Embed/main.m6
-rw-r--r--Tests/RunCMake/add_custom_command/PrintDir.cmake1
-rw-r--r--Tests/RunCMake/add_custom_command/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory.cmake9
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-result.txt (renamed from Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt)0
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stderr.txt (renamed from Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt)0
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stdout.txt (renamed from Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt)0
-rw-r--r--Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake (renamed from Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake)0
-rw-r--r--Tests/SetLang/CMakeLists.txt7
-rw-r--r--Tests/SetLang/bar.c14
-rw-r--r--Tests/SetLang/zoom.zzz7
146 files changed, 1651 insertions, 772 deletions
diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1
index e73aab7..9d7f317 100755
--- a/.gitlab/ci/cmake.ps1
+++ b/.gitlab/ci/cmake.ps1
@@ -1,7 +1,7 @@
$erroractionpreference = "stop"
-$version = "3.18.4"
-$sha256sum = "A932BC0C8EE79F1003204466C525B38A840424D4AE29F9E5FB88959116F2407D"
+$version = "3.19.0"
+$sha256sum = "67BBDA67C98C5F0789199FE1DB650F12274A6AD40FD8CAE88D208029AC618905"
$filename = "cmake-$version-win64-x64"
$tarball = "$filename.zip"
diff --git a/.gitlab/ci/cmake.sh b/.gitlab/ci/cmake.sh
index b4c6ddf..2547663 100755
--- a/.gitlab/ci/cmake.sh
+++ b/.gitlab/ci/cmake.sh
@@ -2,17 +2,17 @@
set -e
-readonly version="3.18.4"
+readonly version="3.19.0"
case "$( uname -s )" in
Linux)
shatool="sha256sum"
- sha256sum="149e0cee002e59e0bb84543cf3cb099f108c08390392605e944daeb6594cbc29"
+ sha256sum="5446cdee900e906e46162a5a7be9b4542bb5e886041cf8cffeda62aae2696ccf"
platform="Linux"
;;
Darwin)
shatool="shasum -a 256"
- sha256sum="9d27049660474cf134ab46fa0e0db771b263313fcb8ba82ee8b2d1a1a62f8f20"
+ sha256sum="315eb5500753f797075b6ea43189420e97b0b9f32c8fc87ec94ba1d80b72eb7f"
platform="Darwin"
;;
*)
diff --git a/.gitlab/ci/configure_macos_common.cmake b/.gitlab/ci/configure_macos_common.cmake
index 3d09779..4bd3c7d 100644
--- a/.gitlab/ci/configure_macos_common.cmake
+++ b/.gitlab/ci/configure_macos_common.cmake
@@ -2,9 +2,7 @@
# detect that Java is available and working, but a test machine then not have a
# working Java installed. To work around this, just act as if Java is not
# available on any CI machine.
-set(Java_JAVA_EXECUTABLE "" CACHE FILEPATH "")
-set(Java_JAVAC_EXECUTABLE "" CACHE FILEPATH "")
-set(Java_JAR_EXECUTABLE "" CACHE FILEPATH "")
+set(CMake_TEST_Java 0 CACHE FILEPATH "")
# Qt binaries get placed inside the source directory, which causes them to not
# be included in the install-time rpath, but we still want them in the
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index a500d36..d9df621 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -7,7 +7,7 @@
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID"
# TODO: Factor this out so that each job selects the Xcode version to
# use so that different versions can be tested in a single pipeline.
- DEVELOPER_DIR: "/Applications/Xcode-11.7.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-12.2.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -63,7 +63,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-11.7
+ - xcode-12.2
- nonconcurrent
.macos_builder_tags_package:
@@ -71,7 +71,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-11.7
+ - xcode-12.2
- nonconcurrent
- finder
@@ -80,7 +80,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-11.7
+ - xcode-12.2
- concurrent
## macOS-specific scripts
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 6830b8a..2e21fdf 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -38,7 +38,7 @@
CMAKE_CONFIGURATION: windows_vs2019_x64_ninja
VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x64"
- VCVARSVERSION: "14.27"
+ VCVARSVERSION: "14.28"
### External testing
@@ -49,7 +49,7 @@
CMAKE_CONFIGURATION: windows_vs2019_x64
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR_PLATFORM: "x64"
- CMAKE_GENERATOR_TOOLSET: "v142,version=14.27"
+ CMAKE_GENERATOR_TOOLSET: "v142,version=14.28"
## Tags
@@ -59,7 +59,7 @@
- windows
- shell
- vs2019
- - msvc-19.27
+ - msvc-19.28
- nonconcurrent
.windows_builder_ext_tags:
@@ -68,7 +68,7 @@
- windows
- shell
- vs2019
- - msvc-19.27
+ - msvc-19.28
- concurrent
## Windows-specific scripts
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index caaf0d5..c3733ab 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -258,7 +258,8 @@ optional argument topic will be appended to the argument list."
(save-selected-window
(select-window (display-buffer buffer 'not-this-window))
(cmake-mode)
- (read-only-mode 1))
+ (read-only-mode 1)
+ (view-mode 1))
)
)
diff --git a/Help/dev/README.rst b/Help/dev/README.rst
index 84da4f1..9c3878b 100644
--- a/Help/dev/README.rst
+++ b/Help/dev/README.rst
@@ -37,9 +37,11 @@ CMake developer documentation is provided by the following documents:
* The `CMake Source Code Guide`_.
* The `CMake Documentation Guide`_.
+* The `CMake Experimental Features Guide`_.
.. _`CMake Source Code Guide`: source.rst
.. _`CMake Documentation Guide`: documentation.rst
+.. _`CMake Experimental Features Guide`: experimental.rst
Maintainer Documentation
========================
diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst
new file mode 100644
index 0000000..4d2b076
--- /dev/null
+++ b/Help/dev/experimental.rst
@@ -0,0 +1,10 @@
+CMake Experimental Features Guide
+*********************************
+
+The following is a guide to CMake experimental features that are
+under development and not yet included in official documentation.
+See documentation on `CMake Development`_ for more information.
+
+.. _`CMake Development`: README.rst
+
+No experimental features are under development in this version of CMake.
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index e90c9ee..8717239 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -280,6 +280,8 @@ Deprecated Utility Modules
/module/CMakeParseArguments
/module/MacroAddFileDependencies
/module/TestCXXAcceptsFlag
+ /module/UseJavaClassFilelist
+ /module/UseJavaSymlinks
/module/UsePkgConfig
/module/Use_wxWindows
/module/WriteBasicConfigVersionFile
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index 62c4b7c..6f137c4 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -93,7 +93,7 @@ Format
An optional array of strings representing the names of presets to inherit
from. The preset will inherit all of the fields from the ``inherits``
presets by default (except ``name``, ``hidden``, ``inherits``,
- ``description``, and ``longDescription``), but can override them as
+ ``description``, and ``displayName``), but can override them as
desired. If multiple ``inherits`` presets provide conflicting values for
the same field, the earlier preset in the ``inherits`` list will be
preferred. Presets in ``CMakePresets.json`` may not inherit from presets
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index cb9579e..f322f0b 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -396,6 +396,10 @@ Properties on Targets
/prop_tgt/WIN32_EXECUTABLE
/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
+ /prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY
+ /prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY
+ /prop_tgt/XCODE_EMBED_type
+ /prop_tgt/XCODE_EMBED_type_PATH
/prop_tgt/XCODE_EXPLICIT_FILE_TYPE
/prop_tgt/XCODE_GENERATE_SCHEME
/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index e947232..00df24b 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -1142,19 +1142,19 @@ Additional configuration settings include:
* `CTest Script`_ variable: none
* :module:`CTest` module variable: ``DRMEMORY_COMMAND_OPTIONS``
-``CudaMemcheckCommand``
+``CudaSanitizerCommand``
Specify a ``MemoryCheckCommand`` that is known to be a command-line
compatible with cuda-memcheck or compute-sanitizer.
* `CTest Script`_ variable: none
- * :module:`CTest` module variable: ``CUDA_MEMCHECK_COMMAND``
+ * :module:`CTest` module variable: ``CUDA_SANITIZER_COMMAND``
-``CudaMemcheckCommandOptions``
- Specify command-line options to the ``CudaMemcheckCommand`` tool.
+``CudaSanitizerCommandOptions``
+ Specify command-line options to the ``CudaSanitizerCommand`` tool.
They will be placed prior to the test command line.
* `CTest Script`_ variable: none
- * :module:`CTest` module variable: ``CUDA_MEMCHECK_COMMAND_OPTIONS``
+ * :module:`CTest` module variable: ``CUDA_SANITIZER_COMMAND_OPTIONS``
.. _`CTest Submit Step`:
diff --git a/Help/module/UseJavaClassFilelist.rst b/Help/module/UseJavaClassFilelist.rst
new file mode 100644
index 0000000..29949be
--- /dev/null
+++ b/Help/module/UseJavaClassFilelist.rst
@@ -0,0 +1,6 @@
+UseJavaClassFilelist
+--------------------
+
+.. versionchanged:: 3.20
+ This module was previously documented by mistake and was never meant for
+ direct inclusion by project code. See the :module:`UseJava` module.
diff --git a/Help/module/UseJavaSymlinks.rst b/Help/module/UseJavaSymlinks.rst
new file mode 100644
index 0000000..1058a68
--- /dev/null
+++ b/Help/module/UseJavaSymlinks.rst
@@ -0,0 +1,6 @@
+UseJavaSymlinks
+---------------
+
+.. versionchanged:: 3.20
+ This module was previously documented by mistake and was never meant for
+ direct inclusion by project code. See the :module:`UseJava` module.
diff --git a/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst
new file mode 100644
index 0000000..7b68126
--- /dev/null
+++ b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY.rst
@@ -0,0 +1,8 @@
+XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY
+----------------------------------------
+
+.. versionadded:: 3.20
+
+Tell the :generator:`Xcode` generator to perform code signing for all the
+frameworks and libraries that are embedded using the
+:prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` property.
diff --git a/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst
new file mode 100644
index 0000000..29f8c5c
--- /dev/null
+++ b/Help/prop_tgt/XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY.rst
@@ -0,0 +1,8 @@
+XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY
+---------------------------------------------
+
+.. versionadded:: 3.20
+
+Tell the :generator:`Xcode` generator to remove headers from all the
+frameworks that are embedded using the
+:prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>` property.
diff --git a/Help/prop_tgt/XCODE_EMBED_type.rst b/Help/prop_tgt/XCODE_EMBED_type.rst
new file mode 100644
index 0000000..90c5bc7
--- /dev/null
+++ b/Help/prop_tgt/XCODE_EMBED_type.rst
@@ -0,0 +1,14 @@
+XCODE_EMBED_<type>
+------------------
+
+.. versionadded:: 3.20
+
+Tell the :generator:`Xcode` generator to embed the specified list of items into
+the target bundle. ``<type>`` specifies the embed build phase to use.
+
+Currently, the only supported value for ``<type>`` is ``FRAMEWORKS``.
+The specified items will be added to the ``Embed Frameworks`` build phase.
+The items can be CMake target names or paths to frameworks or libraries.
+See also :prop_tgt:`XCODE_EMBED_<type>_PATH`,
+:prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` and
+:prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY`.
diff --git a/Help/prop_tgt/XCODE_EMBED_type_PATH.rst b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
new file mode 100644
index 0000000..887cf57
--- /dev/null
+++ b/Help/prop_tgt/XCODE_EMBED_type_PATH.rst
@@ -0,0 +1,9 @@
+XCODE_EMBED_<type>_PATH
+-----------------------
+
+.. versionadded:: 3.20
+
+Tell the :generator:`Xcode` generator the relative path to use when embedding
+the items specified by :prop_tgt:`XCODE_EMBED_<type>`. The path is relative
+to the base location of the ``Embed XXX`` build phase associated with
+``<type>``.
diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst
index be63e9d..a29dc07 100644
--- a/Help/release/3.19.rst
+++ b/Help/release/3.19.rst
@@ -330,3 +330,21 @@ Other Changes
* If ``CUDA`` compiler detection fails with user-specified
:variable:`CMAKE_CUDA_ARCHITECTURES` or
:variable:`CMAKE_CUDA_HOST_COMPILER`, an error is raised.
+
+Updates
+=======
+
+Changes made since CMake 3.19.0 include the following.
+
+3.19.1
+------
+
+* CMake 3.19.0 compiles source files with the :prop_sf:`LANGUAGE`
+ property by passing an explicit language flag such as ``-x c``.
+ This is consistent with the property's documented meaning that
+ the source file is written in the specified language. However,
+ it can break projects that were using the property only to
+ cause the specified language's compiler to be used. This has
+ been reverted to restore behavior from CMake 3.18 and below.
+
+* CUDA 11.1 support for Clang.
diff --git a/Help/release/dev/xcode-embed-frameworks.rst b/Help/release/dev/xcode-embed-frameworks.rst
new file mode 100644
index 0000000..5573fcb
--- /dev/null
+++ b/Help/release/dev/xcode-embed-frameworks.rst
@@ -0,0 +1,9 @@
+xcode-embed-frameworks
+----------------------
+
+* When using the Xcode generator, it is now possible to embed frameworks
+ using the new :prop_tgt:`XCODE_EMBED_FRAMEWORKS <XCODE_EMBED_<type>>`
+ target property. Aspects of the embedding can be customized with the
+ :prop_tgt:`XCODE_EMBED_FRAMEWORKS_PATH <XCODE_EMBED_<type>>`,
+ :prop_tgt:`XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY` and
+ :prop_tgt:`XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY` target properties.
diff --git a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst
index 84ba12d..d5893c9 100644
--- a/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst
+++ b/Help/variable/CTEST_CUSTOM_COVERAGE_EXCLUDE.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_COVERAGE_EXCLUDE
-----------------------------
-.. versionadded:: 3.4
-
A list of regular expressions which will be used to exclude files by their
path from coverage output by the :command:`ctest_coverage` command.
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst
index 7191ce4..cd65ae3 100644
--- a/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst
+++ b/Help/variable/CTEST_CUSTOM_ERROR_EXCEPTION.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_ERROR_EXCEPTION
----------------------------
-.. versionadded:: 3.4
-
A list of regular expressions which will be used to exclude when detecting
error messages in build outputs by the :command:`ctest_test` command.
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst
index 5d213f2..558f5e5 100644
--- a/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst
+++ b/Help/variable/CTEST_CUSTOM_ERROR_MATCH.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_ERROR_MATCH
------------------------
-.. versionadded:: 3.4
-
A list of regular expressions which will be used to detect error messages in
build outputs by the :command:`ctest_test` command.
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst
index 452d060..614859b 100644
--- a/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst
+++ b/Help/variable/CTEST_CUSTOM_ERROR_POST_CONTEXT.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_ERROR_POST_CONTEXT
-------------------------------
-.. versionadded:: 3.4
-
The number of lines to include as context which follow an error message by the
:command:`ctest_test` command. The default is 10.
diff --git a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst
index b7717dd..74dc47a 100644
--- a/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst
+++ b/Help/variable/CTEST_CUSTOM_ERROR_PRE_CONTEXT.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_ERROR_PRE_CONTEXT
------------------------------
-.. versionadded:: 3.4
-
The number of lines to include as context which precede an error message by
the :command:`ctest_test` command. The default is 10.
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
index 31ba099..5aeae88 100644
--- a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
--------------------------------------------
-.. versionadded:: 3.4
-
When saving a failing test's output, this is the maximum size, in bytes, that
will be collected by the :command:`ctest_test` command. Defaults to 307200
(300 KiB).
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst
index e5be1ad..920cb04 100644
--- a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS
-------------------------------------
-.. versionadded:: 3.4
-
The maximum number of errors in a single build step which will be detected.
After this, the :command:`ctest_test` command will truncate the output.
Defaults to 50.
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst
index b513a5c..a1f1cc1 100644
--- a/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS
---------------------------------------
-.. versionadded:: 3.4
-
The maximum number of warnings in a single build step which will be detected.
After this, the :command:`ctest_test` command will truncate the output.
Defaults to 50.
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
index 08762d8..1fbb8c5 100644
--- a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
--------------------------------------------
-.. versionadded:: 3.4
-
When saving a passing test's output, this is the maximum size, in bytes, that
will be collected by the :command:`ctest_test` command. Defaults to 1024
(1 KiB).
diff --git a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst
index 405fc33..578576c 100644
--- a/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst
+++ b/Help/variable/CTEST_CUSTOM_MEMCHECK_IGNORE.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_MEMCHECK_IGNORE
----------------------------
-.. versionadded:: 3.4
-
A list of regular expressions to use to exclude tests during the
:command:`ctest_memcheck` command.
diff --git a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst
index 5e488a7..40291fe 100644
--- a/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst
+++ b/Help/variable/CTEST_CUSTOM_POST_MEMCHECK.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_POST_MEMCHECK
--------------------------
-.. versionadded:: 3.4
-
A list of commands to run at the end of the :command:`ctest_memcheck` command.
.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_POST_TEST.rst b/Help/variable/CTEST_CUSTOM_POST_TEST.rst
index 7ec42f7..791292c 100644
--- a/Help/variable/CTEST_CUSTOM_POST_TEST.rst
+++ b/Help/variable/CTEST_CUSTOM_POST_TEST.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_POST_TEST
----------------------
-.. versionadded:: 3.4
-
A list of commands to run at the end of the :command:`ctest_test` command.
.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst
index 99e47bd..00de8aa 100644
--- a/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst
+++ b/Help/variable/CTEST_CUSTOM_PRE_MEMCHECK.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_PRE_MEMCHECK
-------------------------
-.. versionadded:: 3.4
-
A list of commands to run at the start of the :command:`ctest_memcheck`
command.
diff --git a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst
index 95c6314..6af7152 100644
--- a/Help/variable/CTEST_CUSTOM_PRE_TEST.rst
+++ b/Help/variable/CTEST_CUSTOM_PRE_TEST.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_PRE_TEST
----------------------
-.. versionadded:: 3.4
-
A list of commands to run at the start of the :command:`ctest_test` command.
.. include:: CTEST_CUSTOM_XXX.txt
diff --git a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
index 27a75d9..57222ca 100644
--- a/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
+++ b/Help/variable/CTEST_CUSTOM_TESTS_IGNORE.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_TESTS_IGNORE
-------------------------
-.. versionadded:: 3.14
-
A list of regular expressions to use to exclude tests during the
:command:`ctest_test` command.
diff --git a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst
index 539760b..a03d473 100644
--- a/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst
+++ b/Help/variable/CTEST_CUSTOM_WARNING_EXCEPTION.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_WARNING_EXCEPTION
------------------------------
-.. versionadded:: 3.4
-
A list of regular expressions which will be used to exclude when detecting
warning messages in build outputs by the :command:`ctest_build` command.
diff --git a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst
index 53e7707..18aa6b3 100644
--- a/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst
+++ b/Help/variable/CTEST_CUSTOM_WARNING_MATCH.rst
@@ -1,8 +1,6 @@
CTEST_CUSTOM_WARNING_MATCH
--------------------------
-.. versionadded:: 3.4
-
A list of regular expressions which will be used to detect warning messages in
build outputs by the :command:`ctest_build` command.
diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst
index 5204389..80353a4 100644
--- a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst
+++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst
@@ -6,5 +6,5 @@ CTEST_MEMORYCHECK_TYPE
Specify the CTest ``MemoryCheckType`` setting
in a :manual:`ctest(1)` dashboard client script.
Valid values are ``Valgrind``, ``Purify``, ``BoundsChecker``, ``DrMemory``,
-``CudaMemcheck``, ``ThreadSanitizer``, ``AddressSanitizer``, ``LeakSanitizer``,
+``CudaSanitizer``, ``ThreadSanitizer``, ``AddressSanitizer``, ``LeakSanitizer``,
``MemorySanitizer`` and ``UndefinedBehaviorSanitizer``.
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 9220551..972adef 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -176,13 +176,15 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
# In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
# We first check for a non-scattered installation to prefer it over a scattered installation.
- # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library and version file.
- if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/version.txt")
+ # CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library.
+ if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
- elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt")
+ elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
- elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt")
+ elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/nvvm/libdevice")
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda")
+ else()
+ message(FATAL_ERROR "Couldn't find CUDA library root.")
endif()
# CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files.
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index d907926..a982d2c 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -413,7 +413,14 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
endif()
set(cuda_tools "CUDA ${CMAKE_VS_PLATFORM_TOOLSET_CUDA}")
set(id_compile "CudaCompile")
- set(id_ItemDefinitionGroup_entry "<CudaCompile><AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
+ if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
+ set(cuda_target "<TargetMachinePlatform>64</TargetMachinePlatform>")
+ endif()
+ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
+ string(REGEX MATCH "[0-9]+" arch_name "${arch}")
+ string(APPEND cuda_codegen "compute_${arch_name},sm_${arch_name};")
+ endforeach()
+ set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions><CodeGeneration>${cuda_codegen}</CodeGeneration></CudaCompile>")
set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]])
if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR)
set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>")
@@ -423,9 +430,6 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]])
string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]])
endif()
- if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
- set(id_ItemDefinitionGroup_entry "<CudaCompile><TargetMachinePlatform>64</TargetMachinePlatform><AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
- endif()
if(CMAKE_CUDA_FLAGS MATCHES "(^| )-cudart +shared( |$)")
set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart.lib</AdditionalDependencies>")
else()
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index a18e85b..8f8ebb4 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -121,15 +121,6 @@ if(BUILD_TESTING)
string(APPEND SUBMIT_URL "${DROP_SITE}${DROP_LOCATION}")
endif()
- find_program(CVSCOMMAND cvs )
- set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
- "Options passed to the cvs update command.")
- find_program(SVNCOMMAND svn)
- find_program(BZRCOMMAND bzr)
- find_program(HGCOMMAND hg)
- find_program(GITCOMMAND git)
- find_program(P4COMMAND p4)
-
if(NOT UPDATE_TYPE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
set(UPDATE_TYPE cvs)
@@ -146,21 +137,29 @@ if(BUILD_TESTING)
string(TOLOWER "${UPDATE_TYPE}" _update_type)
if("${_update_type}" STREQUAL "cvs")
+ find_program(CVSCOMMAND cvs )
+ set(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
+ "Options passed to the cvs update command.")
set(UPDATE_COMMAND "${CVSCOMMAND}")
set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "svn")
+ find_program(SVNCOMMAND svn)
set(UPDATE_COMMAND "${SVNCOMMAND}")
set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "bzr")
+ find_program(BZRCOMMAND bzr)
set(UPDATE_COMMAND "${BZRCOMMAND}")
set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "hg")
+ find_program(HGCOMMAND hg)
set(UPDATE_COMMAND "${HGCOMMAND}")
set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "git")
+ find_program(GITCOMMAND git)
set(UPDATE_COMMAND "${GITCOMMAND}")
set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}")
elseif("${_update_type}" STREQUAL "p4")
+ find_program(P4COMMAND p4)
set(UPDATE_COMMAND "${P4COMMAND}")
set(UPDATE_OPTIONS "${P4_UPDATE_OPTIONS}")
endif()
diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake
index a99d8c4..fb87822 100644
--- a/Modules/CheckPIESupported.cmake
+++ b/Modules/CheckPIESupported.cmake
@@ -62,7 +62,7 @@ Examples
#]=======================================================================]
-include (Internal/CMakeCheckCompilerFlag)
+include (Internal/CMakeTryCompilerOrLinkerFlag)
function (check_pie_supported)
cmake_policy(GET CMP0083 cmp0083)
@@ -109,14 +109,16 @@ function (check_pie_supported)
foreach(lang IN LISTS CHECK_PIE_LANGUAGES)
if(_CMAKE_${lang}_PIE_MAY_BE_SUPPORTED_BY_LINKER)
- cmake_check_compiler_flag(${lang} "${CMAKE_${lang}_LINK_OPTIONS_PIE}"
+ cmake_try_compiler_or_linker_flag(${lang}
+ "${CMAKE_${lang}_LINK_OPTIONS_PIE}"
CMAKE_${lang}_LINK_PIE_SUPPORTED
OUTPUT_VARIABLE output)
if (NOT CMAKE_${lang}_LINK_PIE_SUPPORTED)
string (APPEND outputs "PIE (${lang}): ${output}\n")
endif()
- cmake_check_compiler_flag(${lang} "${CMAKE_${lang}_LINK_OPTIONS_NO_PIE}"
+ cmake_try_compiler_or_linker_flag(${lang}
+ "${CMAKE_${lang}_LINK_OPTIONS_NO_PIE}"
CMAKE_${lang}_LINK_NO_PIE_SUPPORTED
OUTPUT_VARIABLE output)
if (NOT CMAKE_${lang}_LINK_NO_PIE_SUPPORTED)
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 26a4bbd..2794f52 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -1,8 +1,6 @@
include(Compiler/Clang)
__compiler_clang(C)
-set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 611c674..15edc21 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -1,8 +1,6 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
-
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index fb6ffa7..7c4a263 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -8,8 +8,6 @@ endif()
if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
-elseif("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
- set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 311d2b0..789e991 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -2,9 +2,7 @@ include(Compiler/Clang)
__compiler_clang(CXX)
__compiler_clang_cxx_standards(CXX)
-
if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
- set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
endif()
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 8105a77..ca286b3 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,8 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(C)
-set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 59ec056..fcaaeab 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -1,8 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
-
if (WIN32)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport")
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 668a6a9..81ab3a2 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -9,7 +9,6 @@ endif()
set(__COMPILER_GNU 1)
include(Compiler/CMakeCommonCompilerMacros)
-include(Internal/CMakeCheckCompilerFlag)
set(__pch_header_C "c-header")
set(__pch_header_CXX "c++-header")
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 322f63d..ec3bfd8 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -28,8 +28,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
else()
- set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 42adfd1..b71b946 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -42,8 +42,6 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
else()
- set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
-
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 78c44d5..2077bda 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -6,8 +6,6 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded")
-set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -qsourcetype=c)
-
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89")
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 3b911f3..41e3e11 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -6,8 +6,6 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded")
-set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -+)
-
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
if(CMAKE_SYSTEM MATCHES "Linux")
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
@@ -34,3 +32,6 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
endif ()
__compiler_check_default_language_standard(CXX 10.1 98)
+
+set(CMAKE_CXX_COMPILE_OBJECT
+ "<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake
index 1668a4d..54c18a6 100644
--- a/Modules/Compiler/XLClang-C.cmake
+++ b/Modules/Compiler/XLClang-C.cmake
@@ -1,8 +1,6 @@
include(Compiler/XLClang)
__compiler_xlclang(C)
-set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake
index 02638c7..9ea3d7c 100644
--- a/Modules/Compiler/XLClang-CXX.cmake
+++ b/Modules/Compiler/XLClang-CXX.cmake
@@ -1,8 +1,6 @@
include(Compiler/XLClang)
__compiler_xlclang(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
-
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 41cb9b7..e5b1e5d 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -71,8 +71,8 @@ ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
DrMemoryCommand: @DRMEMORY_COMMAND@
DrMemoryCommandOptions: @DRMEMORY_COMMAND_OPTIONS@
-CudaMemcheckCommand: @CUDA_MEMCHECK_COMMAND@
-CudaMemcheckCommandOptions: @CUDA_MEMCHECK_COMMAND_OPTIONS@
+CudaSanitizerCommand: @CUDA_SANITIZER_COMMAND@
+CudaSanitizerCommandOptions: @CUDA_SANITIZER_COMMAND_OPTIONS@
MemoryCheckType: @MEMORYCHECK_TYPE@
MemoryCheckSanitizerOptions: @MEMORYCHECK_SANITIZER_OPTIONS@
MemoryCheckCommand: @MEMORYCHECK_COMMAND@
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index ff50869..4380864 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -105,27 +105,6 @@ function(__gtest_find_library _name)
mark_as_advanced(${_name})
endfunction()
-function(__gtest_find_library_configuration _name _lib _cfg_suffix)
- set(_libs ${_lib})
- if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
- # The provided /MD project files for Google Test add -md suffixes to the
- # library names.
- list(INSERT _libs 0 ${_lib}-md)
- endif()
- list(TRANSFORM _libs APPEND "${_cfg_suffix}")
-
- __gtest_find_library(${_name} ${_libs})
-endfunction()
-
-include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
-function(__gtest_find_and_select_library_configurations _basename _lib)
- __gtest_find_library_configuration(${_basename}_LIBRARY_RELEASE ${_lib} "")
- __gtest_find_library_configuration(${_basename}_LIBRARY_DEBUG ${_lib} "d")
-
- select_library_configurations(${_basename})
- set(${_basename}_LIBRARY ${${_basename}_LIBRARY} PARENT_SCOPE)
-endfunction()
-
macro(__gtest_determine_windows_library_type _var)
if(EXISTS "${${_var}}")
file(TO_NATIVE_PATH "${${_var}}" _lib_path)
@@ -250,11 +229,18 @@ find_path(GTEST_INCLUDE_DIR gtest/gtest.h
)
mark_as_advanced(GTEST_INCLUDE_DIR)
-if(NOT GTEST_LIBRARY)
- __gtest_find_and_select_library_configurations(GTEST gtest)
-endif()
-if(NOT GTEST_MAIN_LIBRARY)
- __gtest_find_and_select_library_configurations(GTEST_MAIN gtest_main)
+if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
+ # The provided /MD project files for Google Test add -md suffixes to the
+ # library names.
+ __gtest_find_library(GTEST_LIBRARY gtest-md gtest)
+ __gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd)
+ __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main)
+ __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
+else()
+ __gtest_find_library(GTEST_LIBRARY gtest)
+ __gtest_find_library(GTEST_LIBRARY_DEBUG gtestd)
+ __gtest_find_library(GTEST_MAIN_LIBRARY gtest_main)
+ __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 7af0171..7e17277 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -275,8 +275,10 @@ function(FIND_PACKAGE_CHECK_VERSION version result)
unset (${FPCV_RESULT_MESSAGE_VARIABLE} PARENT_SCOPE)
endif()
- if (CMAKE_FIND_PACKAGE_NAME)
- set (package ${CMAKE_FIND_PACKAGE_NAME})
+ if (_CMAKE_FPHSA_PACKAGE_NAME)
+ set (package "${_CMAKE_FPHSA_PACKAGE_NAME}")
+ elseif (CMAKE_FIND_PACKAGE_NAME)
+ set (package "${CMAKE_FIND_PACKAGE_NAME}")
else()
message (FATAL_ERROR "find_package_check_version(): Cannot be used outside a 'Find Module'")
endif()
@@ -436,6 +438,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
"will be used.")
endif()
+ # to propagate package name to FIND_PACKAGE_CHECK_VERSION
+ set(_CMAKE_FPHSA_PACKAGE_NAME "${_NAME}")
+
# now that we collected all arguments, process them
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
diff --git a/Modules/Internal/CMakeCheckCompilerFlag.cmake b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake
index 9c8dfb6..d6fa5f0 100644
--- a/Modules/Internal/CMakeCheckCompilerFlag.cmake
+++ b/Modules/Internal/CMakeTryCompilerOrLinkerFlag.cmake
@@ -6,13 +6,13 @@
NOTE: This function is used internally by CMake. Projects should not include
this file directly.
-The cmake_check_compiler_flag() function can be used to compile and link a
+The cmake_try_compiler_or_linker_flag() function can be used to compile and link a
source file to check whether a specific compiler or linker flag is supported.
The function does not use the try_compile() command so as to avoid infinite
recursion. It may not work for all platforms or toolchains, the caller is
responsible for ensuring it is only called in valid situations.
- cmake_check_compiler_flag(<lang> <flag> <result>
+ cmake_try_compiler_or_linker_flag(<lang> <flag> <result>
[SRC_EXT <ext>] [COMMAND_PATTERN <pattern>]
[FAIL_REGEX <regex> ...]
[OUTPUT_VARIABLE <output>])
@@ -39,7 +39,7 @@ Optional parameters:
include_guard(GLOBAL)
include(CMakeCheckCompilerFlagCommonPatterns)
-function(CMAKE_CHECK_COMPILER_FLAG lang flag result)
+function(CMAKE_TRY_COMPILER_OR_LINKER_FLAG lang flag result)
# Cache results between runs similar to check_<lang>_source_compiles()
if(DEFINED ${result})
return()
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index f790d87..6b2a11e 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -11,20 +11,20 @@ cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
- if(_lang STREQUAL C)
+ 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")
- elseif(_lang STREQUAL CXX)
+ 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\\+\\+")
- elseif(_lang STREQUAL CUDA)
+ elseif(_lang STREQUAL "CUDA")
set(_lang_src "__host__ int main() { return 0; }")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU
FAIL_REGEX "argument unused during compilation: .*") # Clang
- elseif(_lang STREQUAL Fortran)
+ 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")
- elseif(_lang STREQUAL OBJC)
+ elseif(_lang STREQUAL "OBJC")
set(_lang_src [=[
#ifndef __OBJC__
# error "Not an Objective-C compiler"
@@ -32,7 +32,7 @@ function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
int main(void) { return 0; }]=])
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)
+ elseif(_lang STREQUAL "OBJCXX")
set(_lang_src [=[
#ifndef __OBJC__
# error "Not an Objective-C++ compiler"
@@ -40,7 +40,7 @@ int main(void) { return 0; }]=])
int main(void) { return 0; }]=])
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)
+ 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.")
diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake
index 91c8964..3b2152a 100644
--- a/Modules/Internal/CheckSourceCompiles.cmake
+++ b/Modules/Internal/CheckSourceCompiles.cmake
@@ -10,25 +10,25 @@ cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
if(NOT DEFINED "${_var}")
- if(_lang STREQUAL C)
+ if(_lang STREQUAL "C")
set(_lang_textual "C")
set(_lang_ext "c")
- elseif(_lang STREQUAL CXX)
+ elseif(_lang STREQUAL "CXX")
set(_lang_textual "C++")
set(_lang_ext "cxx")
- elseif(_lang STREQUAL CUDA)
+ elseif(_lang STREQUAL "CUDA")
set(_lang_textual "CUDA")
set(_lang_ext "cu")
- elseif(_lang STREQUAL Fortran)
+ elseif(_lang STREQUAL "Fortran")
set(_lang_textual "Fortran")
set(_lang_ext "F90")
- elseif(_lang STREQUAL ISPC)
+ elseif(_lang STREQUAL "ISPC")
set(_lang_textual "ISPC")
set(_lang_ext "ispc")
- elseif(_lang STREQUAL OBJC)
+ elseif(_lang STREQUAL "OBJC")
set(_lang_textual "Objective-C")
set(_lang_ext "m")
- elseif(_lang STREQUAL OBJCXX)
+ elseif(_lang STREQUAL "OBJCXX")
set(_lang_textual "Objective-C++")
set(_lang_ext "mm")
else()
diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake
index 3a4b758..676f3d0 100644
--- a/Modules/Internal/CheckSourceRuns.cmake
+++ b/Modules/Internal/CheckSourceRuns.cmake
@@ -10,22 +10,22 @@ cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
if(NOT DEFINED "${_var}")
- if(_lang STREQUAL C)
+ if(_lang STREQUAL "C")
set(_lang_textual "C")
set(_lang_ext "c")
- elseif(_lang STREQUAL CXX)
+ elseif(_lang STREQUAL "CXX")
set(_lang_textual "C++")
set(_lang_ext "cxx")
- elseif(_lang STREQUAL CUDA)
+ elseif(_lang STREQUAL "CUDA")
set(_lang_textual "CUDA")
set(_lang_ext "cu")
- elseif(_lang STREQUAL Fortran)
+ elseif(_lang STREQUAL "Fortran")
set(_lang_textual "Fortran")
set(_lang_ext "F90")
- elseif(_lang STREQUAL OBJC)
+ elseif(_lang STREQUAL "OBJC")
set(_lang_textual "Objective-C")
set(_lang_ext "m")
- elseif(_lang STREQUAL OBJCXX)
+ elseif(_lang STREQUAL "OBJCXX")
set(_lang_textual "Objective-C++")
set(_lang_ext "mm")
else()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index cb954e5..7608056 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -2,9 +2,12 @@
# file Copyright.txt or https://cmake.org/licensing for details.
# To ensure maximum portability across various compilers and platforms
-# deactivate any compiler extensions
-set(CMAKE_C_EXTENSIONS FALSE)
-set(CMAKE_CXX_EXTENSIONS FALSE)
+# deactivate any compiler extensions. Skip this for QNX, where additional
+# work is needed to build without compiler extensions.
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ set(CMAKE_C_EXTENSIONS FALSE)
+ set(CMAKE_CXX_EXTENSIONS FALSE)
+endif()
include(CheckIncludeFile)
# Check if we can build support for ELF parsing.
@@ -834,6 +837,7 @@ endif()
# Ninja support
set(SRCS ${SRCS}
+ cmScanDepFormat.cxx
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
cmNinjaTypes.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 7d09a7b..331bbe7 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 19)
-set(CMake_VERSION_PATCH 20201117)
+set(CMake_VERSION_PATCH 20201130)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 73bf764..8a30dc0 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -326,8 +326,8 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml)
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
xml.Attribute("Checker", "BoundsChecker");
break;
- case cmCTestMemCheckHandler::CUDA_MEMCHECK:
- xml.Attribute("Checker", "CudaMemcheck");
+ case cmCTestMemCheckHandler::CUDA_SANITIZER:
+ xml.Attribute("Checker", "CudaSanitizer");
break;
case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
xml.Attribute("Checker", "AddressSanitizer");
@@ -470,7 +470,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
} else if (testerName.find("cuda-memcheck") != std::string::npos ||
testerName.find("compute-sanitizer") != std::string::npos) {
- this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_MEMCHECK;
+ this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_SANITIZER;
} else {
this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
}
@@ -492,10 +492,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->CTest->GetCTestConfiguration("BoundsCheckerCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
} else if (cmSystemTools::FileExists(
- this->CTest->GetCTestConfiguration("CudaMemcheckCommand"))) {
+ this->CTest->GetCTestConfiguration("CudaSanitizerCommand"))) {
this->MemoryTester =
- this->CTest->GetCTestConfiguration("CudaMemcheckCommand");
- this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_MEMCHECK;
+ this->CTest->GetCTestConfiguration("CudaSanitizerCommand");
+ this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_SANITIZER;
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"AddressSanitizer") {
@@ -539,8 +539,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
} else if (checkType == "DrMemory") {
this->MemoryTesterStyle = cmCTestMemCheckHandler::DRMEMORY;
- } else if (checkType == "CudaMemcheck") {
- this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_MEMCHECK;
+ } else if (checkType == "CudaSanitizer") {
+ this->MemoryTesterStyle = cmCTestMemCheckHandler::CUDA_SANITIZER;
}
}
if (this->MemoryTester.empty()) {
@@ -566,10 +566,10 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
.empty()) {
memoryTesterOptions =
this->CTest->GetCTestConfiguration("DrMemoryCommandOptions");
- } else if (!this->CTest->GetCTestConfiguration("CudaMemcheckCommandOptions")
+ } else if (!this->CTest->GetCTestConfiguration("CudaSanitizerCommandOptions")
.empty()) {
memoryTesterOptions =
- this->CTest->GetCTestConfiguration("CudaMemcheckCommandOptions");
+ this->CTest->GetCTestConfiguration("CudaSanitizerCommandOptions");
}
this->MemoryTesterOptions =
cmSystemTools::ParseArguments(memoryTesterOptions);
@@ -703,8 +703,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
this->MemoryTesterOptions.emplace_back("/M");
break;
}
- case cmCTestMemCheckHandler::CUDA_MEMCHECK: {
- // cuda-memcheck separates flags from arguments by spaces
+ case cmCTestMemCheckHandler::CUDA_SANITIZER: {
+ // cuda sanitizer separates flags from arguments by spaces
if (this->MemoryTesterOptions.empty()) {
this->MemoryTesterOptions.emplace_back("--tool");
this->MemoryTesterOptions.emplace_back("memcheck");
@@ -800,7 +800,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
return this->ProcessMemCheckSanitizerOutput(str, log, results);
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
return this->ProcessMemCheckBoundsCheckerOutput(str, log, results);
- case cmCTestMemCheckHandler::CUDA_MEMCHECK:
+ case cmCTestMemCheckHandler::CUDA_SANITIZER:
return this->ProcessMemCheckCudaOutput(str, log, results);
default:
log.append("\nMemory checking style used was: ");
@@ -1188,7 +1188,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
if (memcheckLine.find(lines[cc])) {
cmCTestOptionalLog(this->CTest, DEBUG,
- "cuda-memcheck line " << lines[cc] << std::endl,
+ "cuda sanitizer line " << lines[cc] << std::endl,
this->Quiet);
int failure = -1;
auto& line = lines[cc];
@@ -1219,7 +1219,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput(
nonMemcheckOutput.push_back(cc);
}
}
- // Now put all all the non cuda-memcheck output into the test output
+ // Now put all all the non cuda sanitizer output into the test output
// This should be last in case it gets truncated by the output
// limiting code
for (std::string::size_type i : nonMemcheckOutput) {
diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h
index 6ef5d20..7ab00db 100644
--- a/Source/CTest/cmCTestMemCheckHandler.h
+++ b/Source/CTest/cmCTestMemCheckHandler.h
@@ -45,7 +45,7 @@ private:
DRMEMORY,
BOUNDS_CHECKER,
// checkers after here do not use the standard error list
- CUDA_MEMCHECK,
+ CUDA_SANITIZER,
ADDRESS_SANITIZER,
LEAK_SANITIZER,
THREAD_SANITIZER,
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 1c7e4b1..7c36144 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -349,13 +349,6 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
if (language.empty()) {
language = "C";
}
-
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source->GetProperty("LANGUAGE")) {
- lg->AppendFeatureOptions(flags, language, "EXPLICIT_LANGUAGE");
- }
-
std::string const& config =
lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
diff --git a/Source/cmFileTime.cxx b/Source/cmFileTime.cxx
index 96c70fe..0606baf 100644
--- a/Source/cmFileTime.cxx
+++ b/Source/cmFileTime.cxx
@@ -24,13 +24,13 @@ bool cmFileTime::Load(std::string const& fileName)
}
# if CMake_STAT_HAS_ST_MTIM
// Nanosecond resolution
- this->NS = fst.st_mtim.tv_sec * NsPerS + fst.st_mtim.tv_nsec;
+ this->Time = fst.st_mtim.tv_sec * UtPerS + fst.st_mtim.tv_nsec;
# elif CMake_STAT_HAS_ST_MTIMESPEC
// Nanosecond resolution
- this->NS = fst.st_mtimespec.tv_sec * NsPerS + fst.st_mtimespec.tv_nsec;
+ this->Time = fst.st_mtimespec.tv_sec * UtPerS + fst.st_mtimespec.tv_nsec;
# else
// Second resolution
- this->NS = fst.st_mtime * NsPerS;
+ this->Time = fst.st_mtime * UtPerS;
# endif
#else
// Windows version. Get the modification time from extended file attributes.
@@ -41,10 +41,11 @@ bool cmFileTime::Load(std::string const& fileName)
}
// Copy the file time to the output location.
- this->NS = (static_cast<NSC>(fdata.ftLastWriteTime.dwHighDateTime) << 32) |
- static_cast<NSC>(fdata.ftLastWriteTime.dwLowDateTime);
- // The file time resolution is 100 ns.
- this->NS *= 100;
+ using uint64 = unsigned long long;
+
+ this->Time = static_cast<TimeType>(
+ (uint64(fdata.ftLastWriteTime.dwHighDateTime) << 32) +
+ fdata.ftLastWriteTime.dwLowDateTime);
#endif
return true;
}
diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h
index f496cdc..4419880 100644
--- a/Source/cmFileTime.h
+++ b/Source/cmFileTime.h
@@ -13,9 +13,15 @@
class cmFileTime
{
public:
- using NSC = long long;
- static constexpr NSC NsPerS = 1000000000;
-
+ using TimeType = long long;
+ // unit time per second
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ // unit time is one nanosecond
+ static constexpr TimeType UtPerS = 1000000000;
+#else
+ // unit time is 100 nanosecond
+ static constexpr TimeType UtPerS = 10000000;
+#endif
cmFileTime() = default;
~cmFileTime() = default;
@@ -28,22 +34,28 @@ public:
/**
* @brief Return true if this is older than ftm
*/
- bool Older(cmFileTime const& ftm) const { return (this->NS - ftm.NS) < 0; }
+ bool Older(cmFileTime const& ftm) const
+ {
+ return (this->Time - ftm.Time) < 0;
+ }
/**
* @brief Return true if this is newer than ftm
*/
- bool Newer(cmFileTime const& ftm) const { return (ftm.NS - this->NS) < 0; }
+ bool Newer(cmFileTime const& ftm) const
+ {
+ return (ftm.Time - this->Time) < 0;
+ }
/**
* @brief Return true if this is the same as ftm
*/
- bool Equal(cmFileTime const& ftm) const { return this->NS == ftm.NS; }
+ bool Equal(cmFileTime const& ftm) const { return this->Time == ftm.Time; }
/**
* @brief Return true if this is not the same as ftm
*/
- bool Differ(cmFileTime const& ftm) const { return this->NS != ftm.NS; }
+ bool Differ(cmFileTime const& ftm) const { return this->Time != ftm.Time; }
/**
* @brief Compare file modification times.
@@ -51,7 +63,7 @@ public:
*/
int Compare(cmFileTime const& ftm) const
{
- NSC const diff = this->NS - ftm.NS;
+ TimeType const diff = this->Time - ftm.Time;
if (diff == 0) {
return 0;
}
@@ -65,7 +77,7 @@ public:
*/
bool OlderS(cmFileTime const& ftm) const
{
- return (ftm.NS - this->NS) >= cmFileTime::NsPerS;
+ return (ftm.Time - this->Time) >= cmFileTime::UtPerS;
}
/**
@@ -73,7 +85,7 @@ public:
*/
bool NewerS(cmFileTime const& ftm) const
{
- return (this->NS - ftm.NS) >= cmFileTime::NsPerS;
+ return (this->Time - ftm.Time) >= cmFileTime::UtPerS;
}
/**
@@ -81,11 +93,11 @@ public:
*/
bool EqualS(cmFileTime const& ftm) const
{
- NSC diff = this->NS - ftm.NS;
+ TimeType diff = this->Time - ftm.Time;
if (diff < 0) {
diff = -diff;
}
- return (diff < cmFileTime::NsPerS);
+ return (diff < cmFileTime::UtPerS);
}
/**
@@ -93,11 +105,11 @@ public:
*/
bool DifferS(cmFileTime const& ftm) const
{
- NSC diff = this->NS - ftm.NS;
+ TimeType diff = this->Time - ftm.Time;
if (diff < 0) {
diff = -diff;
}
- return (diff >= cmFileTime::NsPerS);
+ return (diff >= cmFileTime::UtPerS);
}
/**
@@ -107,21 +119,21 @@ public:
*/
int CompareS(cmFileTime const& ftm) const
{
- NSC const diff = this->NS - ftm.NS;
- if (diff <= -cmFileTime::NsPerS) {
+ TimeType const diff = this->Time - ftm.Time;
+ if (diff <= -cmFileTime::UtPerS) {
return -1;
}
- if (diff >= cmFileTime::NsPerS) {
+ if (diff >= cmFileTime::UtPerS) {
return 1;
}
return 0;
}
/**
- * @brief The file modification time in nanoseconds
+ * @brief The file modification time in unit time per second
*/
- NSC GetNS() const { return this->NS; }
+ TimeType GetTime() const { return this->Time; }
private:
- NSC NS = 0;
+ TimeType Time = 0;
};
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 80b3775..63aaf27 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -584,7 +584,8 @@ void cmGlobalGenerator::EnableLanguage(
// Find the native build tool for this generator.
// This has to be done early so that MSBuild can be used to examine the
// cross-compilation environment.
- if (!this->FindMakeProgram(mf)) {
+ if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Early &&
+ !this->FindMakeProgram(mf)) {
return;
}
}
@@ -660,6 +661,12 @@ void cmGlobalGenerator::EnableLanguage(
cmSystemTools::SetFatalErrorOccured();
return;
}
+
+ // Find the native build tool for this generator.
+ if (this->GetFindMakeProgramStage() == FindMakeProgramStage::Late &&
+ !this->FindMakeProgram(mf)) {
+ return;
+ }
}
// Check that the languages are supported by the generator and its
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index e933589..69373bd 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -610,6 +610,17 @@ protected:
std::string GetPredefinedTargetsFolder() const;
+ enum class FindMakeProgramStage
+ {
+ Early,
+ Late,
+ };
+
+ virtual FindMakeProgramStage GetFindMakeProgramStage() const
+ {
+ return FindMakeProgramStage::Late;
+ }
+
private:
using TargetMap = std::unordered_map<std::string, cmTarget*>;
using GeneratorTargetMap =
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 83d15ab..7ef69f4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -34,6 +34,7 @@
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmRange.h"
+#include "cmScanDepFormat.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
@@ -2024,6 +2025,8 @@ void cmGlobalNinjaGenerator::StripNinjaOutputPathPrefixAsSuffix(
cmStripSuffixIfExists(path, this->OutputPathPrefix);
}
+#if !defined(CMAKE_BOOTSTRAP)
+
/*
We use the following approach to support Fortran. Each target already
@@ -2103,16 +2106,6 @@ Compilation of source files within a target is split into the following steps:
(because the latter consumes the module).
*/
-struct cmSourceInfo
-{
- // Set of provided and required modules.
- std::set<std::string> Provides;
- std::set<std::string> Requires;
-
- // Set of files included in the translation unit.
- std::set<std::string> Includes;
-};
-
static std::unique_ptr<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
std::string const& arg_tdi, std::string const& arg_pp);
@@ -2120,6 +2113,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
std::string arg_tdi;
+ std::string arg_src;
std::string arg_pp;
std::string arg_dep;
std::string arg_obj;
@@ -2128,6 +2122,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
for (std::string const& arg : cmMakeRange(argBeg, argEnd)) {
if (cmHasLiteralPrefix(arg, "--tdi=")) {
arg_tdi = arg.substr(6);
+ } else if (cmHasLiteralPrefix(arg, "--src=")) {
+ arg_src = arg.substr(6);
} else if (cmHasLiteralPrefix(arg, "--pp=")) {
arg_pp = arg.substr(5);
} else if (cmHasLiteralPrefix(arg, "--dep=")) {
@@ -2168,6 +2164,9 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
cmSystemTools::Error("-E cmake_ninja_depends requires value for --lang=");
return 1;
}
+ if (arg_src.empty()) {
+ arg_src = cmStrCat("<", arg_obj, " input file>");
+ }
std::unique_ptr<cmSourceInfo> info;
if (arg_lang == "Fortran") {
@@ -2184,6 +2183,8 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
return 1;
}
+ info->PrimaryOutput = arg_obj;
+
{
cmGeneratedFileStream depfile(arg_dep);
depfile << cmSystemTools::ConvertToUnixOutputPath(arg_pp) << ":";
@@ -2193,24 +2194,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
depfile << "\n";
}
- Json::Value ddi(Json::objectValue);
- ddi["object"] = arg_obj;
-
- Json::Value& ddi_provides = ddi["provides"] = Json::arrayValue;
- for (std::string const& provide : info->Provides) {
- ddi_provides.append(provide);
- }
- Json::Value& ddi_requires = ddi["requires"] = Json::arrayValue;
- for (std::string const& r : info->Requires) {
- // Require modules not provided in the same source.
- if (!info->Provides.count(r)) {
- ddi_requires.append(r);
- }
- }
-
- cmGeneratedFileStream ddif(arg_ddi);
- ddif << ddi;
- if (!ddif) {
+ if (!cmScanDepFormat_P1689_Write(arg_ddi, arg_src, *info)) {
cmSystemTools::Error(
cmStrCat("-E cmake_ninja_depends failed to write ", arg_ddi));
return 1;
@@ -2268,19 +2252,28 @@ std::unique_ptr<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
}
auto info = cm::make_unique<cmSourceInfo>();
- info->Provides = finfo.Provides;
- info->Requires = finfo.Requires;
- info->Includes = finfo.Includes;
+ for (std::string const& provide : finfo.Provides) {
+ cmSourceReqInfo src_info;
+ src_info.LogicalName = provide;
+ src_info.CompiledModulePath = provide;
+ info->Provides.emplace_back(src_info);
+ }
+ for (std::string const& require : finfo.Requires) {
+ // Require modules not provided in the same source.
+ if (finfo.Provides.count(require)) {
+ continue;
+ }
+ cmSourceReqInfo src_info;
+ src_info.LogicalName = require;
+ src_info.CompiledModulePath = require;
+ info->Requires.emplace_back(src_info);
+ }
+ for (std::string const& include : finfo.Includes) {
+ info->Includes.push_back(include);
+ }
return info;
}
-struct cmDyndepObjectInfo
-{
- std::string Object;
- std::vector<std::string> Provides;
- std::vector<std::string> Requires;
-};
-
bool cmGlobalNinjaGenerator::WriteDyndepFile(
std::string const& dir_top_src, std::string const& dir_top_bld,
std::string const& dir_cur_src, std::string const& dir_cur_bld,
@@ -2302,34 +2295,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
this->LocalGenerators.push_back(std::move(lgd));
}
- std::vector<cmDyndepObjectInfo> objects;
+ std::vector<cmSourceInfo> objects;
for (std::string const& arg_ddi : arg_ddis) {
- // Load the ddi file and compute the module file paths it provides.
- Json::Value ddio;
- Json::Value const& ddi = ddio;
- cmsys::ifstream ddif(arg_ddi.c_str(), std::ios::in | std::ios::binary);
- Json::Reader reader;
- if (!reader.parse(ddif, ddio, false)) {
- cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep failed to parse ",
- arg_ddi,
- reader.getFormattedErrorMessages()));
+ cmSourceInfo info;
+ if (!cmScanDepFormat_P1689_Parse(arg_ddi, &info)) {
+ cmSystemTools::Error(
+ cmStrCat("-E cmake_ninja_dyndep failed to parse ddi file ", arg_ddi));
return false;
}
-
- cmDyndepObjectInfo info;
- info.Object = ddi["object"].asString();
- Json::Value const& ddi_provides = ddi["provides"];
- if (ddi_provides.isArray()) {
- for (auto const& ddi_provide : ddi_provides) {
- info.Provides.push_back(ddi_provide.asString());
- }
- }
- Json::Value const& ddi_requires = ddi["requires"];
- if (ddi_requires.isArray()) {
- for (auto const& ddi_require : ddi_requires) {
- info.Requires.push_back(ddi_require.asString());
- }
- }
objects.push_back(std::move(info));
}
@@ -2360,11 +2333,12 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
// We do this after loading the modules provided by linked targets
// in case we have one of the same name that must be preferred.
Json::Value tm = Json::objectValue;
- for (cmDyndepObjectInfo const& object : objects) {
- for (std::string const& p : object.Provides) {
- std::string const mod = cmStrCat(module_dir, p);
- mod_files[p] = mod;
- tm[p] = mod;
+ for (cmSourceInfo const& object : objects) {
+ for (auto const& p : object.Provides) {
+ std::string const mod = cmStrCat(
+ module_dir, cmSystemTools::GetFilenameName(p.CompiledModulePath));
+ mod_files[p.LogicalName] = mod;
+ tm[p.LogicalName] = mod;
}
}
@@ -2374,15 +2348,16 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
{
cmNinjaBuild build("dyndep");
build.Outputs.emplace_back("");
- for (cmDyndepObjectInfo const& object : objects) {
- build.Outputs[0] = object.Object;
+ for (cmSourceInfo const& object : objects) {
+ build.Outputs[0] = this->ConvertToNinjaPath(object.PrimaryOutput);
build.ImplicitOuts.clear();
- for (std::string const& p : object.Provides) {
- build.ImplicitOuts.push_back(this->ConvertToNinjaPath(mod_files[p]));
+ for (auto const& p : object.Provides) {
+ build.ImplicitOuts.push_back(
+ this->ConvertToNinjaPath(mod_files[p.LogicalName]));
}
build.ImplicitDeps.clear();
- for (std::string const& r : object.Requires) {
- auto mit = mod_files.find(r);
+ for (auto const& r : object.Requires) {
+ auto mit = mod_files.find(r.LogicalName);
if (mit != mod_files.end()) {
build.ImplicitDeps.push_back(this->ConvertToNinjaPath(mit->second));
}
@@ -2406,11 +2381,6 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
return true;
}
-bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const
-{
- return !this->CrossConfigs.empty();
-}
-
int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
std::vector<std::string>::const_iterator argEnd)
{
@@ -2492,6 +2462,13 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
return 0;
}
+#endif
+
+bool cmGlobalNinjaGenerator::EnableCrossConfigBuild() const
+{
+ return !this->CrossConfigs.empty();
+}
+
void cmGlobalNinjaGenerator::AppendDirectoryForConfig(
const std::string& prefix, const std::string& config,
const std::string& suffix, std::string& dir)
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 3c46408..3bfcbd0 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -166,6 +166,11 @@ protected:
void WriteSLNHeader(std::ostream& fout);
+ FindMakeProgramStage GetFindMakeProgramStage() const override
+ {
+ return FindMakeProgramStage::Early;
+ }
+
bool ComputeTargetDepends() override;
class VSDependSet : public std::set<std::string>
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 026e96c..78c7538 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -773,7 +773,9 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects()
this->TargetGroup.clear();
this->FileRefs.clear();
this->ExternalLibRefs.clear();
+ this->EmbeddedLibRefs.clear();
this->FileRefToBuildFileMap.clear();
+ this->FileRefToEmbedBuildFileMap.clear();
this->CommandsVisited.clear();
}
@@ -936,14 +938,6 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
default:
break;
}
-
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (sf->GetProperty("LANGUAGE")) {
- this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang,
- "EXPLICIT_LANGUAGE");
- }
-
const std::string COMPILE_FLAGS("COMPILE_FLAGS");
if (cmProp cflags = sf->GetProperty(COMPILE_FLAGS)) {
lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS));
@@ -1205,7 +1199,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
}
}
// Make a copy so that we can override it later
- std::string path = fullpath;
+ std::string path = cmSystemTools::CollapseFullPath(fullpath);
// Compute the extension without leading '.'.
std::string ext = cmSystemTools::GetFilenameLastExtension(path);
if (!ext.empty()) {
@@ -1801,6 +1795,10 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
if (frameworkBuildPhase) {
buildPhases->AddObject(frameworkBuildPhase);
}
+
+ // When this build phase is present, it must be last. More build phases may
+ // be added later for embedding things and they will insert themselves just
+ // before this last build phase.
if (postBuildPhase) {
buildPhases->AddObject(postBuildPhase);
}
@@ -1972,6 +1970,15 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase(
return buildPhase;
}
+namespace {
+void ReplaceScriptVars(std::string& cmd)
+{
+ cmSystemTools::ReplaceString(cmd, "$(CONFIGURATION)", "$CONFIGURATION");
+ cmSystemTools::ReplaceString(cmd, "$(EFFECTIVE_PLATFORM_NAME)",
+ "$EFFECTIVE_PLATFORM_NAME");
+}
+}
+
std::string cmGlobalXCodeGenerator::ConstructScript(
cmCustomCommandGenerator const& ccg)
{
@@ -1982,6 +1989,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript(
wd = lg->GetCurrentBinaryDirectory();
}
wd = lg->ConvertToOutputFormat(wd, cmOutputConverter::SHELL);
+ ReplaceScriptVars(wd);
script = cmStrCat(script, " cd ", wd, "\n");
for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) {
std::string cmd = ccg.GetCommand(c);
@@ -1991,9 +1999,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript(
cmSystemTools::ReplaceString(cmd, "/./", "/");
cmd = lg->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL);
ccg.AppendArguments(c, cmd);
- cmSystemTools::ReplaceString(cmd, "$(CONFIGURATION)", "$CONFIGURATION");
- cmSystemTools::ReplaceString(cmd, "$(EFFECTIVE_PLATFORM_NAME)",
- "$EFFECTIVE_PLATFORM_NAME");
+ ReplaceScriptVars(cmd);
script = cmStrCat(script, " ", cmd, '\n');
}
return script;
@@ -3632,6 +3638,130 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
}
+void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target)
+{
+ cmGeneratorTarget* gt = target->GetTarget();
+ if (!gt) {
+ cmSystemTools::Error("Error no target on xobject\n");
+ return;
+ }
+ if (!gt->IsInBuildSystem()) {
+ return;
+ }
+ bool isFrameworkTarget = gt->IsFrameworkOnApple();
+ bool isBundleTarget = gt->GetPropertyAsBool("MACOSX_BUNDLE");
+ bool isCFBundleTarget = gt->IsCFBundleOnApple();
+ if (!(isFrameworkTarget || isBundleTarget || isCFBundleTarget)) {
+ return;
+ }
+ cmProp files = gt->GetProperty("XCODE_EMBED_FRAMEWORKS");
+ if (!files) {
+ return;
+ }
+
+ // Create an "Embedded Frameworks" build phase
+ auto* copyFilesBuildPhase =
+ this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase);
+ std::string copyFilesBuildPhaseName = "Embed Frameworks";
+ std::string destinationFrameworks = "10";
+ copyFilesBuildPhase->SetComment(copyFilesBuildPhaseName);
+ copyFilesBuildPhase->AddAttribute("buildActionMask",
+ this->CreateString("2147483647"));
+ copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
+ this->CreateString(destinationFrameworks));
+ copyFilesBuildPhase->AddAttribute(
+ "name", this->CreateString(copyFilesBuildPhaseName));
+ if (cmProp fwEmbedPath = gt->GetProperty("XCODE_EMBED_FRAMEWORKS_PATH")) {
+ copyFilesBuildPhase->AddAttribute("dstPath",
+ this->CreateString(*fwEmbedPath));
+ } else {
+ copyFilesBuildPhase->AddAttribute("dstPath", this->CreateString(""));
+ }
+ copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
+ this->CreateString("0"));
+ cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ // Collect all embedded frameworks and add them to build phase
+ std::vector<std::string> relFiles = cmExpandedList(*files);
+ for (std::string const& relFile : relFiles) {
+ cmXCodeObject* buildFile{ nullptr };
+ std::string filePath = relFile;
+ auto* genTarget = FindGeneratorTarget(relFile);
+ if (genTarget) {
+ // This is a target - get it's product path reference
+ auto* xcTarget = FindXCodeTarget(genTarget);
+ if (!xcTarget) {
+ cmSystemTools::Error("Can not find a target for " +
+ genTarget->GetName());
+ continue;
+ }
+ // Add the target output file as a build reference for other targets
+ // to link against
+ auto* fileRefObject = xcTarget->GetAttribute("productReference");
+ if (!fileRefObject) {
+ cmSystemTools::Error("Target " + genTarget->GetName() +
+ " is missing product reference");
+ continue;
+ }
+ auto it = FileRefToEmbedBuildFileMap.find(fileRefObject);
+ if (it == FileRefToEmbedBuildFileMap.end()) {
+ buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
+ buildFile->AddAttribute("fileRef", fileRefObject);
+ FileRefToEmbedBuildFileMap[fileRefObject] = buildFile;
+ } else {
+ buildFile = it->second;
+ }
+ } else if (cmSystemTools::IsPathToFramework(relFile)) {
+ // This is a regular string path - create file reference
+ auto it = EmbeddedLibRefs.find(relFile);
+ if (it == EmbeddedLibRefs.end()) {
+ cmXCodeObject* fileRef =
+ this->CreateXCodeFileReferenceFromPath(relFile, gt, "", nullptr);
+ if (fileRef) {
+ buildFile = this->CreateObject(cmXCodeObject::PBXBuildFile);
+ buildFile->SetComment(fileRef->GetComment());
+ buildFile->AddAttribute("fileRef",
+ this->CreateObjectReference(fileRef));
+ }
+ if (!buildFile) {
+ cmSystemTools::Error("Can't create build file for " + relFile);
+ continue;
+ }
+ this->EmbeddedLibRefs.emplace(filePath, buildFile);
+ } else {
+ buildFile = it->second;
+ }
+ }
+ if (!buildFile) {
+ cmSystemTools::Error("Can't find a build file for " + relFile);
+ continue;
+ }
+ // Set build file configuration
+ cmXCodeObject* settings =
+ this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
+ cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+ const auto& rmHeadersProp =
+ gt->GetSafeProperty("XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY");
+ if (cmIsOn(rmHeadersProp)) {
+ attrs->AddObject(this->CreateString("RemoveHeadersOnCopy"));
+ }
+ const auto& codeSignProp =
+ gt->GetSafeProperty("XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY");
+ if (cmIsOn(codeSignProp)) {
+ attrs->AddObject(this->CreateString("CodeSignOnCopy"));
+ }
+ settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
+ buildFile->AddAttributeIfNotEmpty("settings", settings);
+ if (!buildFiles->HasObject(buildFile)) {
+ buildFiles->AddObject(buildFile);
+ }
+ }
+ copyFilesBuildPhase->AddAttribute("files", buildFiles);
+ auto* buildPhases = target->GetAttribute("buildPhases");
+ // Insert embed build phase right before the post-build command
+ buildPhases->InsertObject(buildPhases->GetObjectCount() - 1,
+ copyFilesBuildPhase);
+}
+
bool cmGlobalXCodeGenerator::CreateGroups(
std::vector<cmLocalGenerator*>& generators)
{
@@ -4010,7 +4140,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
// loop over all targets and add link and depend info
for (auto t : targets) {
this->AddDependAndLinkInformation(t);
+ this->AddEmbeddedFrameworks(t);
}
+
if (this->XcodeBuildSystem == BuildSystem::One) {
this->CreateXCodeDependHackMakefile(targets);
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 5b05214..3cc4efe 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -124,6 +124,11 @@ protected:
void AddExtraIDETargets() override;
void Generate() override;
+ FindMakeProgramStage GetFindMakeProgramStage() const override
+ {
+ return FindMakeProgramStage::Early;
+ }
+
private:
bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
bool ProcessGeneratorToolsetField(std::string const& key,
@@ -182,6 +187,7 @@ private:
const std::string& configName);
cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget* gtgt);
void AddDependAndLinkInformation(cmXCodeObject* target);
+ void AddEmbeddedFrameworks(cmXCodeObject* target);
void AddPositionIndependentLinkAttribute(cmGeneratorTarget* target,
cmXCodeObject* buildSettings,
const std::string& configName);
@@ -319,8 +325,10 @@ private:
std::map<std::string, cmXCodeObject*> TargetGroup;
std::map<std::string, cmXCodeObject*> FileRefs;
std::map<std::string, cmXCodeObject*> ExternalLibRefs;
+ std::map<std::string, cmXCodeObject*> EmbeddedLibRefs;
std::map<cmGeneratorTarget const*, cmXCodeObject*> XCodeObjectMap;
std::map<cmXCodeObject*, cmXCodeObject*> FileRefToBuildFileMap;
+ std::map<cmXCodeObject*, cmXCodeObject*> FileRefToEmbedBuildFileMap;
std::vector<std::string> Architectures;
std::string ObjectDirArchDefault;
std::string ObjectDirArch;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8f3a0d8..71660a0 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -573,13 +573,6 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Build the set of compiler flags.
std::string flags;
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source.GetProperty("LANGUAGE")) {
- this->LocalGenerator->AppendFeatureOptions(flags, lang,
- "EXPLICIT_LANGUAGE");
- }
-
// Add language-specific flags.
std::string langFlags = cmStrCat("$(", lang, "_FLAGS", filterArch, ")");
this->LocalGenerator->AppendFlags(flags, langFlags);
@@ -838,13 +831,17 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
this->GetFlags(lang, this->GetConfigName()));
std::string langDefines = std::string("$(") + lang + "_DEFINES)";
- compileCommand.replace(compileCommand.find(langDefines),
- langDefines.size(),
- this->GetDefines(lang, this->GetConfigName()));
+ std::string::size_type ldPos = compileCommand.find(langDefines);
+ if (ldPos != std::string::npos) {
+ compileCommand.replace(ldPos, langDefines.size(),
+ this->GetDefines(lang, this->GetConfigName()));
+ }
std::string langIncludes = std::string("$(") + lang + "_INCLUDES)";
- compileCommand.replace(compileCommand.find(langIncludes),
- langIncludes.size(),
- this->GetIncludes(lang, this->GetConfigName()));
+ std::string::size_type liPos = compileCommand.find(langIncludes);
+ if (liPos != std::string::npos) {
+ compileCommand.replace(liPos, langIncludes.size(),
+ this->GetIncludes(lang, this->GetConfigName()));
+ }
cmProp eliminate[] = {
this->Makefile->GetDefinition("CMAKE_START_TEMP_FILE"),
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index f2bec8c..6085b25 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -183,16 +183,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
}
- std::string flags;
- // explicitly add the explicit language flag before any other flag
- // this way backwards compatibility with user flags is maintained
- if (source->GetProperty("LANGUAGE")) {
- this->LocalGenerator->AppendFeatureOptions(flags, language,
- "EXPLICIT_LANGUAGE");
- flags += " ";
- }
-
- flags += this->GetFlags(language, config, filterArch);
+ std::string flags = this->GetFlags(language, config, filterArch);
// Add Fortran format flags.
if (language == "Fortran") {
@@ -532,7 +523,7 @@ std::string GetScanCommand(const std::string& cmakeCmd, const std::string& tdi,
const std::string& ddiFile)
{
return cmStrCat(cmakeCmd, " -E cmake_ninja_depends --tdi=", tdi,
- " --lang=", lang, " --pp=", ppFile,
+ " --lang=", lang, " --src=$in", " --pp=", ppFile,
" --dep=$DEP_FILE --obj=$OBJ_FILE --ddi=", ddiFile);
}
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
new file mode 100644
index 0000000..40bf4c9
--- /dev/null
+++ b/Source/cmScanDepFormat.cxx
@@ -0,0 +1,267 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmScanDepFormat.h"
+
+#include <cctype>
+#include <cstdio>
+
+#include <cm3p/json/reader.h>
+#include <cm3p/json/value.h>
+#include <cm3p/json/writer.h>
+
+#include "cmsys/FStream.hxx"
+
+#include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
+
+static bool ParseFilename(Json::Value const& val, std::string& result)
+{
+ if (val.isString()) {
+ result = val.asString();
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+static Json::Value EncodeFilename(std::string const& path)
+{
+ std::string data;
+ data.reserve(path.size());
+
+ for (auto const& byte : path) {
+ if (std::iscntrl(byte)) {
+ // Control characters.
+ data.append("\\u");
+ char buf[5];
+ std::snprintf(buf, sizeof(buf), "%04x", byte);
+ data.append(buf);
+ } else if (byte == '"' || byte == '\\') {
+ // Special JSON characters.
+ data.push_back('\\');
+ data.push_back(byte);
+ } else {
+ // Other data.
+ data.push_back(byte);
+ }
+ }
+
+ return data;
+}
+
+#define PARSE_BLOB(val, res) \
+ do { \
+ if (!ParseFilename(val, res)) { \
+ cmSystemTools::Error( \
+ cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, \
+ ": invalid blob")); \
+ return false; \
+ } \
+ } while (0)
+
+#define PARSE_FILENAME(val, res) \
+ do { \
+ if (!ParseFilename(val, res)) { \
+ cmSystemTools::Error( \
+ cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp, \
+ ": invalid filename")); \
+ return false; \
+ } \
+ \
+ if (!cmSystemTools::FileIsFullPath(res)) { \
+ res = cmStrCat(work_directory, '/', res); \
+ } \
+ } while (0)
+
+bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, cmSourceInfo* info)
+{
+ Json::Value ppio;
+ Json::Value const& ppi = ppio;
+ cmsys::ifstream ppf(arg_pp.c_str(), std::ios::in | std::ios::binary);
+ {
+ Json::Reader reader;
+ if (!reader.parse(ppf, ppio, false)) {
+ cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ",
+ arg_pp,
+ reader.getFormattedErrorMessages()));
+ return false;
+ }
+ }
+
+ Json::Value const& version = ppi["version"];
+ if (version.asUInt() != 0) {
+ cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ",
+ arg_pp, ": version ", version.asString()));
+ return false;
+ }
+
+ Json::Value const& rules = ppi["rules"];
+ if (rules.isArray()) {
+ if (rules.size() != 1) {
+ cmSystemTools::Error(cmStrCat("-E cmake_ninja_depends failed to parse ",
+ arg_pp, ": expected 1 source entry"));
+ return false;
+ }
+
+ for (auto const& rule : rules) {
+ Json::Value const& workdir = rule["work-directory"];
+ if (!workdir.isString()) {
+ cmSystemTools::Error(
+ cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp,
+ ": work-directory is not a string"));
+ return false;
+ }
+ std::string work_directory;
+ PARSE_BLOB(workdir, work_directory);
+
+ Json::Value const& depends = rule["depends"];
+ if (depends.isArray()) {
+ std::string depend_filename;
+ for (auto const& depend : depends) {
+ PARSE_FILENAME(depend, depend_filename);
+ info->Includes.push_back(depend_filename);
+ }
+ }
+
+ if (rule.isMember("future-compile")) {
+ Json::Value const& future_compile = rule["future-compile"];
+
+ if (future_compile.isMember("outputs")) {
+ Json::Value const& outputs = future_compile["outputs"];
+ if (outputs.isArray()) {
+ if (outputs.empty()) {
+ cmSystemTools::Error(
+ cmStrCat("-E cmake_ninja_depends failed to parse ", arg_pp,
+ ": expected at least one 1 output"));
+ return false;
+ }
+
+ PARSE_FILENAME(outputs[0], info->PrimaryOutput);
+ }
+ }
+
+ if (future_compile.isMember("provides")) {
+ Json::Value const& provides = future_compile["provides"];
+ if (provides.isArray()) {
+ for (auto const& provide : provides) {
+ cmSourceReqInfo provide_info;
+
+ Json::Value const& logical_name = provide["logical-name"];
+ PARSE_BLOB(logical_name, provide_info.LogicalName);
+
+ if (provide.isMember("compiled-module-path")) {
+ Json::Value const& compiled_module_path =
+ provide["compiled-module-path"];
+ PARSE_FILENAME(compiled_module_path,
+ provide_info.CompiledModulePath);
+ } else {
+ provide_info.CompiledModulePath =
+ cmStrCat(provide_info.LogicalName, ".mod");
+ }
+
+ info->Provides.push_back(provide_info);
+ }
+ }
+ }
+
+ if (future_compile.isMember("requires")) {
+ Json::Value const& reqs = future_compile["requires"];
+ if (reqs.isArray()) {
+ for (auto const& require : reqs) {
+ cmSourceReqInfo require_info;
+
+ Json::Value const& logical_name = require["logical-name"];
+ PARSE_BLOB(logical_name, require_info.LogicalName);
+
+ if (require.isMember("compiled-module-path")) {
+ Json::Value const& compiled_module_path =
+ require["compiled-module-path"];
+ PARSE_FILENAME(compiled_module_path,
+ require_info.CompiledModulePath);
+ }
+
+ info->Requires.push_back(require_info);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool cmScanDepFormat_P1689_Write(std::string const& path,
+ std::string const& input,
+ cmSourceInfo const& info)
+{
+ Json::Value ddi(Json::objectValue);
+ ddi["version"] = 0;
+ ddi["revision"] = 0;
+
+ Json::Value& rules = ddi["rules"] = Json::arrayValue;
+
+ Json::Value rule(Json::objectValue);
+ rule["work-directory"] =
+ EncodeFilename(cmSystemTools::GetCurrentWorkingDirectory());
+ Json::Value& inputs = rule["inputs"] = Json::arrayValue;
+ inputs.append(EncodeFilename(input));
+
+ Json::Value& rule_outputs = rule["outputs"] = Json::arrayValue;
+ rule_outputs.append(EncodeFilename(path));
+
+ Json::Value& depends = rule["depends"] = Json::arrayValue;
+ for (auto const& include : info.Includes) {
+ depends.append(EncodeFilename(include));
+ }
+
+ Json::Value& future_compile = rule["future-compile"] = Json::objectValue;
+
+ Json::Value& outputs = future_compile["outputs"] = Json::arrayValue;
+ outputs.append(info.PrimaryOutput);
+
+ Json::Value& provides = future_compile["provides"] = Json::arrayValue;
+ for (auto const& provide : info.Provides) {
+ Json::Value provide_obj(Json::objectValue);
+ auto const encoded = EncodeFilename(provide.LogicalName);
+ provide_obj["logical-name"] = encoded;
+ if (provide.CompiledModulePath.empty()) {
+ provide_obj["compiled-module-path"] = encoded;
+ } else {
+ provide_obj["compiled-module-path"] =
+ EncodeFilename(provide.CompiledModulePath);
+ }
+
+ // TODO: Source file tracking. See below.
+
+ provides.append(provide_obj);
+ }
+
+ Json::Value& reqs = future_compile["requires"] = Json::arrayValue;
+ for (auto const& require : info.Requires) {
+ Json::Value require_obj(Json::objectValue);
+ auto const encoded = EncodeFilename(require.LogicalName);
+ require_obj["logical-name"] = encoded;
+ if (require.CompiledModulePath.empty()) {
+ require_obj["compiled-module-path"] = encoded;
+ } else {
+ require_obj["compiled-module-path"] =
+ EncodeFilename(require.CompiledModulePath);
+ }
+
+ // TODO: Source filename inclusion. Requires collating with the provides
+ // filenames (as a sanity check if available on both sides).
+
+ reqs.append(require_obj);
+ }
+
+ rules.append(rule);
+
+ cmGeneratedFileStream ddif(path);
+ ddif << ddi;
+
+ return !!ddif;
+}
diff --git a/Source/cmScanDepFormat.h b/Source/cmScanDepFormat.h
new file mode 100644
index 0000000..1ad0ecf
--- /dev/null
+++ b/Source/cmScanDepFormat.h
@@ -0,0 +1,30 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <string>
+#include <vector>
+
+struct cmSourceReqInfo
+{
+ std::string LogicalName;
+ std::string CompiledModulePath;
+};
+
+struct cmSourceInfo
+{
+ std::string PrimaryOutput;
+
+ // Set of provided and required modules.
+ std::vector<cmSourceReqInfo> Provides;
+ std::vector<cmSourceReqInfo> Requires;
+
+ // Set of files included in the translation unit.
+ std::vector<std::string> Includes;
+};
+
+bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
+ cmSourceInfo* info);
+bool cmScanDepFormat_P1689_Write(std::string const& path,
+ std::string const& input,
+ cmSourceInfo const& info);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 35224eb..9db5dc6 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2053,35 +2053,37 @@ std::string cmTarget::ImportedGetFullPath(
}
if (result.empty()) {
- auto message = [&]() -> std::string {
- std::string unset;
- std::string configuration;
-
- if (artifact == cmStateEnums::RuntimeBinaryArtifact) {
- unset = "IMPORTED_LOCATION";
- } else if (artifact == cmStateEnums::ImportLibraryArtifact) {
- unset = "IMPORTED_IMPLIB";
- }
-
- if (!config.empty()) {
- configuration = cmStrCat(" configuration \"", config, "\"");
- }
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ auto message = [&]() -> std::string {
+ std::string unset;
+ std::string configuration;
+
+ if (artifact == cmStateEnums::RuntimeBinaryArtifact) {
+ unset = "IMPORTED_LOCATION";
+ } else if (artifact == cmStateEnums::ImportLibraryArtifact) {
+ unset = "IMPORTED_IMPLIB";
+ }
- return cmStrCat(unset, " not set for imported target \"",
- this->GetName(), "\"", configuration, ".");
- };
+ if (!config.empty()) {
+ configuration = cmStrCat(" configuration \"", config, "\"");
+ }
- switch (this->GetPolicyStatus(cmPolicies::CMP0111)) {
- case cmPolicies::WARN:
- impl->Makefile->IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" +
- message());
- CM_FALLTHROUGH;
- case cmPolicies::OLD:
- break;
- default:
- impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message());
+ return cmStrCat(unset, " not set for imported target \"",
+ this->GetName(), "\"", configuration, ".");
+ };
+
+ switch (this->GetPolicyStatus(cmPolicies::CMP0111)) {
+ case cmPolicies::WARN:
+ impl->Makefile->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0111) + "\n" +
+ message());
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ break;
+ default:
+ impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, message());
+ }
}
result = cmStrCat(this->GetName(), "-NOTFOUND");
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ab66fd0..9c41504 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3972,7 +3972,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
if (managedType != cmGeneratorTarget::ManagedType::Native &&
this->GeneratorTarget->GetManagedType(config) !=
cmGeneratorTarget::ManagedType::Native &&
- l.Target->IsImported()) {
+ l.Target->IsImported() &&
+ l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
auto location = l.Target->GetFullPath(config);
if (!location.empty()) {
ConvertToWindowsSlash(location);
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index 78d4727..ab7f99e 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -81,6 +81,13 @@ public:
void SetObject(cmXCodeObject* value) { this->Object = value; }
cmXCodeObject* GetObject() { return this->Object; }
void AddObject(cmXCodeObject* value) { this->List.push_back(value); }
+ size_t GetObjectCount() { return this->List.size(); }
+ void InsertObject(size_t position, cmXCodeObject* value)
+ {
+ if (position < GetObjectCount()) {
+ this->List.insert(this->List.begin() + position, value);
+ }
+ }
void PrependObject(cmXCodeObject* value)
{
this->List.insert(this->List.begin(), value);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4a2bb49..5524d4e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -132,6 +132,131 @@ namespace {
using JsonValueMapType = std::unordered_map<std::string, Json::Value>;
#endif
+struct CommandArgument
+{
+ enum struct Values
+ {
+ Zero,
+ One,
+ Two,
+ };
+
+ std::string InvalidSyntaxMessage;
+ std::string InvalidValueMessage;
+ std::string Name;
+ CommandArgument::Values Type;
+ std::function<bool(std::string const& value, cmake* state)> StoreCall;
+
+ template <typename FunctionType>
+ CommandArgument(std::string n, CommandArgument::Values t,
+ FunctionType&& func)
+ : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n))
+ , InvalidValueMessage(cmStrCat("Invalid value used with ", n))
+ , Name(std::move(n))
+ , Type(t)
+ , StoreCall(std::forward<FunctionType>(func))
+ {
+ }
+
+ template <typename FunctionType>
+ CommandArgument(std::string n, std::string failedMsg,
+ CommandArgument::Values t, FunctionType&& func)
+ : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n))
+ , InvalidValueMessage(std::move(failedMsg))
+ , Name(std::move(n))
+ , Type(t)
+ , StoreCall(std::forward<FunctionType>(func))
+ {
+ }
+
+ bool matches(std::string const& input) const
+ {
+ return cmHasPrefix(input, this->Name);
+ }
+
+ template <typename T>
+ bool parse(std::string const& input, T& index,
+ std::vector<std::string> const& allArgs, cmake* state) const
+ {
+ enum struct ParseMode
+ {
+ Valid,
+ Invalid,
+ SyntaxError,
+ ValueError
+ };
+ ParseMode parseState = ParseMode::Valid;
+
+ // argument is the next parameter
+ if (this->Type == CommandArgument::Values::Zero) {
+ if (input.size() == this->Name.size()) {
+ parseState = this->StoreCall(input, state) ? ParseMode::Valid
+ : ParseMode::Invalid;
+ } else {
+ parseState = ParseMode::SyntaxError;
+ }
+
+ } else if (this->Type == CommandArgument::Values::One) {
+ if (input.size() == this->Name.size()) {
+ ++index;
+ if (index >= allArgs.size() || allArgs[index][0] == '-') {
+ parseState = ParseMode::ValueError;
+ } else {
+ parseState = this->StoreCall(allArgs[index], state)
+ ? ParseMode::Valid
+ : ParseMode::Invalid;
+ }
+ } else {
+ // parse the string to get the value
+ auto possible_value = cm::string_view(input).substr(this->Name.size());
+ if (possible_value.empty()) {
+ parseState = ParseMode::SyntaxError;
+ parseState = ParseMode::ValueError;
+ } else if (possible_value[0] == '=') {
+ possible_value.remove_prefix(1);
+ if (possible_value.empty()) {
+ parseState = ParseMode::ValueError;
+ } else {
+ parseState = this->StoreCall(std::string(possible_value), state)
+ ? ParseMode::Valid
+ : ParseMode::Invalid;
+ }
+ }
+ if (parseState == ParseMode::Valid) {
+ parseState = this->StoreCall(std::string(possible_value), state)
+ ? ParseMode::Valid
+ : ParseMode::Invalid;
+ }
+ }
+ } else if (this->Type == CommandArgument::Values::Two) {
+ if (input.size() == this->Name.size()) {
+ if (index + 2 >= allArgs.size() || allArgs[index + 1][0] == '-' ||
+ allArgs[index + 2][0] == '-') {
+ parseState = ParseMode::ValueError;
+ } else {
+ index += 2;
+ parseState =
+ this->StoreCall(cmStrCat(allArgs[index - 1], ";", allArgs[index]),
+ state)
+ ? ParseMode::Valid
+ : ParseMode::Invalid;
+ }
+ }
+ }
+
+ if (parseState == ParseMode::SyntaxError) {
+ cmSystemTools::Error(this->InvalidSyntaxMessage);
+ } else if (parseState == ParseMode::ValueError) {
+ cmSystemTools::Error(this->InvalidValueMessage);
+ }
+ return (parseState == ParseMode::Valid);
+ }
+};
+
+auto IgnoreAndTrueLambda = [](std::string const&, cmake*) -> bool {
+ return true;
+};
+
} // namespace
static bool cmakeCheckStampFile(const std::string& stampName);
@@ -384,152 +509,145 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
{
auto findPackageMode = false;
auto seenScriptOption = false;
- for (unsigned int i = 1; i < args.size(); ++i) {
- std::string const& arg = args[i];
- if (cmHasLiteralPrefix(arg, "-D")) {
- std::string entry = arg.substr(2);
- if (entry.empty()) {
- ++i;
- if (i < args.size()) {
- entry = args[i];
- } else {
- cmSystemTools::Error("-D must be followed with VAR=VALUE.");
- return false;
- }
- }
- std::string var;
- std::string value;
- cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
- if (cmState::ParseCacheEntry(entry, var, value, type)) {
+
+ auto DefineLambda = [](std::string const& entry, cmake* state) -> bool {
+ std::string var;
+ std::string value;
+ cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED;
+ if (cmState::ParseCacheEntry(entry, var, value, type)) {
#ifndef CMAKE_BOOTSTRAP
- this->UnprocessedPresetVariables.erase(var);
+ state->UnprocessedPresetVariables.erase(var);
#endif
- this->ProcessCacheArg(var, value, type);
- } else {
- cmSystemTools::Error("Parse error in command line argument: " + arg +
- "\n" + "Should be: VAR:type=value\n");
- return false;
- }
- } else if (cmHasLiteralPrefix(arg, "-W")) {
- std::string entry = arg.substr(2);
- if (entry.empty()) {
- ++i;
- if (i < args.size()) {
- entry = args[i];
- } else {
- cmSystemTools::Error("-W must be followed with [no-]<name>.");
- return false;
- }
- }
+ state->ProcessCacheArg(var, value, type);
+ } else {
+ cmSystemTools::Error(cmStrCat("Parse error in command line argument: ",
+ entry, "\n Should be: VAR:type=value\n"));
+ return false;
+ }
+ return true;
+ };
- std::string name;
- bool foundNo = false;
- bool foundError = false;
- unsigned int nameStartPosition = 0;
+ auto WarningLambda = [](cm::string_view entry, cmake* state) -> bool {
+ bool foundNo = false;
+ bool foundError = false;
- if (entry.find("no-", nameStartPosition) == 0) {
- foundNo = true;
- nameStartPosition += 3;
- }
+ if (cmHasLiteralPrefix(entry, "no-")) {
+ foundNo = true;
+ entry.remove_prefix(3);
+ }
- if (entry.find("error=", nameStartPosition) == 0) {
- foundError = true;
- nameStartPosition += 6;
- }
+ if (cmHasLiteralPrefix(entry, "error=")) {
+ foundError = true;
+ entry.remove_prefix(6);
+ }
- name = entry.substr(nameStartPosition);
- if (name.empty()) {
- cmSystemTools::Error("No warning name provided.");
- return false;
- }
+ if (entry.empty()) {
+ cmSystemTools::Error("No warning name provided.");
+ return false;
+ }
- if (!foundNo && !foundError) {
- // -W<name>
- this->DiagLevels[name] = std::max(this->DiagLevels[name], DIAG_WARN);
- } else if (foundNo && !foundError) {
- // -Wno<name>
- this->DiagLevels[name] = DIAG_IGNORE;
- } else if (!foundNo && foundError) {
- // -Werror=<name>
- this->DiagLevels[name] = DIAG_ERROR;
- } else {
- // -Wno-error=<name>
- this->DiagLevels[name] = std::min(this->DiagLevels[name], DIAG_WARN);
- }
- } else if (cmHasLiteralPrefix(arg, "-U")) {
- std::string entryPattern = arg.substr(2);
- if (entryPattern.empty()) {
- ++i;
- if (i < args.size()) {
- entryPattern = args[i];
- } else {
- cmSystemTools::Error("-U must be followed with VAR.");
- return false;
- }
+ std::string const name = std::string(entry);
+ if (!foundNo && !foundError) {
+ // -W<name>
+ state->DiagLevels[name] = std::max(state->DiagLevels[name], DIAG_WARN);
+ } else if (foundNo && !foundError) {
+ // -Wno<name>
+ state->DiagLevels[name] = DIAG_IGNORE;
+ } else if (!foundNo && foundError) {
+ // -Werror=<name>
+ state->DiagLevels[name] = DIAG_ERROR;
+ } else {
+ // -Wno-error=<name>
+ // This can downgrade an error to a warning, but should not enable
+ // or disable a warning in the first place.
+ auto dli = state->DiagLevels.find(name);
+ if (dli != state->DiagLevels.end()) {
+ dli->second = std::min(dli->second, DIAG_WARN);
}
- cmsys::RegularExpression regex(
- cmsys::Glob::PatternToRegex(entryPattern, true, true));
- // go through all cache entries and collect the vars which will be
- // removed
- std::vector<std::string> entriesToDelete;
- std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
- for (std::string const& ck : cacheKeys) {
- cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(ck);
- if (t != cmStateEnums::STATIC) {
- if (regex.find(ck)) {
- entriesToDelete.push_back(ck);
- }
+ }
+ return true;
+ };
+
+ auto UnSetLambda = [](std::string const& entryPattern,
+ cmake* state) -> bool {
+ cmsys::RegularExpression regex(
+ cmsys::Glob::PatternToRegex(entryPattern, true, true));
+ // go through all cache entries and collect the vars which will be
+ // removed
+ std::vector<std::string> entriesToDelete;
+ std::vector<std::string> cacheKeys = state->State->GetCacheEntryKeys();
+ for (std::string const& ck : cacheKeys) {
+ cmStateEnums::CacheEntryType t = state->State->GetCacheEntryType(ck);
+ if (t != cmStateEnums::STATIC) {
+ if (regex.find(ck)) {
+ entriesToDelete.push_back(ck);
}
}
+ }
- // now remove them from the cache
- for (std::string const& currentEntry : entriesToDelete) {
+ // now remove them from the cache
+ for (std::string const& currentEntry : entriesToDelete) {
#ifndef CMAKE_BOOTSTRAP
- this->UnprocessedPresetVariables.erase(currentEntry);
+ state->UnprocessedPresetVariables.erase(currentEntry);
#endif
- this->State->RemoveCacheEntry(currentEntry);
- }
- } else if (cmHasLiteralPrefix(arg, "-C")) {
- std::string path = arg.substr(2);
- if (path.empty()) {
- ++i;
- if (i < args.size()) {
- path = args[i];
- } else {
- cmSystemTools::Error("-C must be followed by a file name.");
- return false;
- }
- }
- cmSystemTools::Stdout("loading initial cache file " + path + "\n");
- // Resolve script path specified on command line relative to $PWD.
- path = cmSystemTools::CollapseFullPath(path);
- this->ReadListFile(args, path);
- } else if (cmHasLiteralPrefix(arg, "-P")) {
- i++;
- if (i >= args.size()) {
- cmSystemTools::Error("-P must be followed by a file name.");
- return false;
- }
- std::string path = args[i];
- if (path.empty()) {
- cmSystemTools::Error("No cmake script provided.");
- return false;
- }
- // Register fake project commands that hint misuse in script mode.
- GetProjectCommandsInScriptMode(this->GetState());
- // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be
- // set to $PWD for -P mode.
- this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetHomeOutputDirectory(
- cmSystemTools::GetCurrentWorkingDirectory());
- this->ReadListFile(args, path);
- seenScriptOption = true;
- } else if (arg == "--" && seenScriptOption) {
+ state->State->RemoveCacheEntry(currentEntry);
+ }
+ return true;
+ };
+
+ auto ScriptLambda = [&](std::string const& path, cmake* state) -> bool {
+ // Register fake project commands that hint misuse in script mode.
+ GetProjectCommandsInScriptMode(state->GetState());
+ // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be
+ // set to $PWD for -P mode.
+ state->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ state->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
+ state->ReadListFile(args, path);
+ seenScriptOption = true;
+ return true;
+ };
+
+ std::vector<CommandArgument> arguments = {
+ CommandArgument{ "-D", "-D must be followed with VAR=VALUE.",
+ CommandArgument::Values::One, DefineLambda },
+ CommandArgument{ "-W", "-W must be followed with [no-]<name>.",
+ CommandArgument::Values::One, WarningLambda },
+ CommandArgument{ "-U", "-U must be followed with VAR.",
+ CommandArgument::Values::One, UnSetLambda },
+ CommandArgument{ "-C", "-C must be followed by a file name.",
+ CommandArgument::Values::One,
+ [&](std::string const& value, cmake* state) -> bool {
+ cmSystemTools::Stdout("loading initial cache file " +
+ value + "\n");
+ // Resolve script path specified on command line
+ // relative to $PWD.
+ auto path = cmSystemTools::CollapseFullPath(value);
+ state->ReadListFile(args, path);
+ return true;
+ } },
+ CommandArgument{ "-P", "-P must be followed by a file name.",
+ CommandArgument::Values::One, ScriptLambda },
+ CommandArgument{ "--find-package", CommandArgument::Values::Zero,
+ [&](std::string const&, cmake*) -> bool {
+ findPackageMode = true;
+ return true;
+ } },
+ };
+ for (decltype(args.size()) i = 1; i < args.size(); ++i) {
+ std::string const& arg = args[i];
+
+ if (arg == "--" && seenScriptOption) {
// Stop processing CMake args and avoid possible errors
// when arbitrary args are given to CMake script.
break;
- } else if (cmHasLiteralPrefix(arg, "--find-package")) {
- findPackageMode = true;
+ }
+ for (auto const& m : arguments) {
+ if (m.matches(arg)) {
+ const bool parsedCorrectly = m.parse(arg, i, args, this);
+ if (!parsedCorrectly) {
+ return false;
+ }
+ }
}
}
@@ -734,249 +852,315 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::string presetName;
bool listPresets = false;
#endif
- for (unsigned int i = 1; i < args.size(); ++i) {
- std::string const& arg = args[i];
- if (cmHasLiteralPrefix(arg, "-H") || cmHasLiteralPrefix(arg, "-S")) {
- std::string path = arg.substr(2);
- if (path.empty()) {
- ++i;
- if (i >= args.size()) {
- cmSystemTools::Error("No source directory specified for -S");
- return;
- }
- path = args[i];
- if (path[0] == '-') {
- cmSystemTools::Error("No source directory specified for -S");
- return;
- }
- }
- path = cmSystemTools::CollapseFullPath(path);
- cmSystemTools::ConvertToUnixSlashes(path);
- this->SetHomeDirectory(path);
- // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
- // NOLINTNEXTLINE(bugprone-branch-clone)
- } else if (cmHasLiteralPrefix(arg, "-O")) {
- // There is no local generate anymore. Ignore -O option.
- } else if (cmHasLiteralPrefix(arg, "-B")) {
- std::string path = arg.substr(2);
- if (path.empty()) {
- ++i;
- if (i >= args.size()) {
- cmSystemTools::Error("No build directory specified for -B");
- return;
- }
- path = args[i];
- if (path[0] == '-') {
- cmSystemTools::Error("No build directory specified for -B");
- return;
- }
- }
+ auto SourceArgLambda = [](std::string const& value, cmake* state) -> bool {
+ std::string path = cmSystemTools::CollapseFullPath(value);
+ cmSystemTools::ConvertToUnixSlashes(path);
+ state->SetHomeDirectory(path);
+ return true;
+ };
- path = cmSystemTools::CollapseFullPath(path);
- cmSystemTools::ConvertToUnixSlashes(path);
- this->SetHomeOutputDirectory(path);
- haveBArg = true;
- } else if ((i < args.size() - 2) &&
- cmHasLiteralPrefix(arg, "--check-build-system")) {
- this->CheckBuildSystemArgument = args[++i];
- this->ClearBuildSystem = (atoi(args[++i].c_str()) > 0);
- } else if ((i < args.size() - 1) &&
- cmHasLiteralPrefix(arg, "--check-stamp-file")) {
- this->CheckStampFile = args[++i];
- } else if ((i < args.size() - 1) &&
- cmHasLiteralPrefix(arg, "--check-stamp-list")) {
- this->CheckStampList = args[++i];
- } else if (arg == "--regenerate-during-build"_s) {
- this->RegenerateDuringBuild = true;
+ auto BuildArgLambda = [&](std::string const& value, cmake* state) -> bool {
+ std::string path = cmSystemTools::CollapseFullPath(value);
+ cmSystemTools::ConvertToUnixSlashes(path);
+ state->SetHomeOutputDirectory(path);
+ haveBArg = true;
+ return true;
+ };
+
+ auto PlatformLambda = [&](std::string const& value, cmake* state) -> bool {
+ if (havePlatform) {
+ cmSystemTools::Error("Multiple -A options not allowed");
+ return false;
}
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- else if ((i < args.size() - 1) &&
- cmHasLiteralPrefix(arg, "--vs-solution-file")) {
- this->VSSolutionFile = args[++i];
+ state->SetGeneratorPlatform(value);
+ havePlatform = true;
+ return true;
+ };
+
+ auto ToolsetLamda = [&](std::string const& value, cmake* state) -> bool {
+ if (haveToolset) {
+ cmSystemTools::Error("Multiple -T options not allowed");
+ return false;
}
+ state->SetGeneratorToolset(value);
+ haveToolset = true;
+ return true;
+ };
+
+ std::vector<CommandArgument> arguments = {
+ CommandArgument{ "-S", "No source directory specified for -S",
+ CommandArgument::Values::One, SourceArgLambda },
+ CommandArgument{ "-H", "No source directory specified for -H",
+ CommandArgument::Values::One, SourceArgLambda },
+ CommandArgument{ "-O", CommandArgument::Values::Zero,
+ IgnoreAndTrueLambda },
+ CommandArgument{ "-B", "No build directory specified for -B",
+ CommandArgument::Values::One, BuildArgLambda },
+ CommandArgument{ "-P", "-P must be followed by a file name.",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument{ "-D", "-D must be followed with VAR=VALUE.",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument{ "-C", "-C must be followed by a file name.",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument{ "-U", "-U must be followed with VAR.",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument{ "-W", "-W must be followed with [no-]<name>.",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
+ CommandArgument{ "-A", "No platform specified for -A",
+ CommandArgument::Values::One, PlatformLambda },
+ CommandArgument{ "-T", "No toolset specified for -T",
+ CommandArgument::Values::One, ToolsetLamda },
+
+ CommandArgument{ "--check-build-system", CommandArgument::Values::Two,
+ [](std::string const& value, cmake* state) -> bool {
+ std::vector<std::string> values = cmExpandedList(value);
+ state->CheckBuildSystemArgument = values[0];
+ state->ClearBuildSystem = (atoi(values[1].c_str()) > 0);
+ return true;
+ } },
+ CommandArgument{ "--check-stamp-file", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ state->CheckStampFile = value;
+ return true;
+ } },
+ CommandArgument{ "--check-stamp-list", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ state->CheckStampList = value;
+ return true;
+ } },
+ CommandArgument{ "--regenerate-during-build",
+ CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ state->RegenerateDuringBuild = true;
+ return true;
+ } },
+
+ CommandArgument{ "--find-package", CommandArgument::Values::Zero,
+ IgnoreAndTrueLambda },
+
+ CommandArgument{ "--graphviz", "No file specified for --graphviz",
+ CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ std::string path =
+ cmSystemTools::CollapseFullPath(value);
+ cmSystemTools::ConvertToUnixSlashes(path);
+ state->GraphVizFile = path;
+ return true;
+ } },
+
+ CommandArgument{ "--debug-trycompile", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "debug trycompile on\n";
+ state->DebugTryCompileOn();
+ return true;
+ } },
+ CommandArgument{ "--debug-output", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Running with debug output on.\n";
+ state->SetDebugOutputOn(true);
+ return true;
+ } },
+
+ CommandArgument{ "--log-level", "Invalid level specified for --log-level",
+ CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ const auto logLevel = StringToLogLevel(value);
+ if (logLevel == LogLevel::LOG_UNDEFINED) {
+ cmSystemTools::Error(
+ "Invalid level specified for --log-level");
+ return false;
+ }
+ state->SetLogLevel(logLevel);
+ state->LogLevelWasSetViaCLI = true;
+ return true;
+ } },
+ // This is supported for backward compatibility. This option only
+ // appeared in the 3.15.x release series and was renamed to
+ // --log-level in 3.16.0
+ CommandArgument{ "--loglevel", "Invalid level specified for --loglevel",
+ CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ const auto logLevel = StringToLogLevel(value);
+ if (logLevel == LogLevel::LOG_UNDEFINED) {
+ cmSystemTools::Error(
+ "Invalid level specified for --loglevel");
+ return false;
+ }
+ state->SetLogLevel(logLevel);
+ state->LogLevelWasSetViaCLI = true;
+ return true;
+ } },
+
+ CommandArgument{ "--log-context", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ state->SetShowLogContext(true);
+ return true;
+ } },
+ CommandArgument{
+ "--debug-find", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Running with debug output on for the `find` commands.\n";
+ state->SetDebugFindOutputOn(true);
+ return true;
+ } },
+ CommandArgument{ "--trace-expand", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Running with expanded trace output on.\n";
+ state->SetTrace(true);
+ state->SetTraceExpand(true);
+ return true;
+ } },
+ CommandArgument{ "--trace-format", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ state->SetTrace(true);
+ const auto traceFormat = StringToTraceFormat(value);
+ if (traceFormat == TraceFormat::TRACE_UNDEFINED) {
+ cmSystemTools::Error(
+ "Invalid format specified for --trace-format. "
+ "Valid formats are human, json-v1.");
+ return false;
+ }
+ state->SetTraceFormat(traceFormat);
+ return true;
+ } },
+ CommandArgument{ "--trace-source", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ std::string file(value);
+ cmSystemTools::ConvertToUnixSlashes(file);
+ state->AddTraceSource(file);
+ state->SetTrace(true);
+ return true;
+ } },
+ CommandArgument{ "--trace-redirect", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ std::string file(value);
+ cmSystemTools::ConvertToUnixSlashes(file);
+ state->SetTraceFile(file);
+ state->SetTrace(true);
+ return true;
+ } },
+ CommandArgument{ "--trace", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Running with trace output on.\n";
+ state->SetTrace(true);
+ state->SetTraceExpand(false);
+ return true;
+ } },
+ CommandArgument{ "--warn-uninitialized", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Warn about uninitialized values.\n";
+ state->SetWarnUninitialized(true);
+ return true;
+ } },
+ CommandArgument{ "--warn-unused-vars", CommandArgument::Values::Zero,
+ IgnoreAndTrueLambda }, // Option was removed.
+ CommandArgument{ "--no-warn-unused-cli", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout
+ << "Not searching for unused variables given on the "
+ << "command line.\n";
+ state->SetWarnUnusedCli(false);
+ return true;
+ } },
+ CommandArgument{
+ "--check-system-vars", CommandArgument::Values::Zero,
+ [](std::string const&, cmake* state) -> bool {
+ std::cout << "Also check system files when warning about unused and "
+ << "uninitialized variables.\n";
+ state->SetCheckSystemVars(true);
+ return true;
+ } }
+ };
+
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ arguments.emplace_back("--vs-solution-file", CommandArgument::Values::One,
+ [](std::string const& value, cmake* state) -> bool {
+ state->VSSolutionFile = value;
+ return true;
+ });
#endif
- else if (cmHasLiteralPrefix(arg, "-D") || cmHasLiteralPrefix(arg, "-U") ||
- cmHasLiteralPrefix(arg, "-C")) {
- // skip for now
- // in case '-[DUC] argval' var' is given, also skip the next
- // in case '-[DUC]argval' is given, don't skip the next
- if (arg.size() == 2) {
- ++i;
- }
- // XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
- // NOLINTNEXTLINE(bugprone-branch-clone)
- } else if (cmHasLiteralPrefix(arg, "-P")) {
- // skip for now
- i++;
- } else if (cmHasLiteralPrefix(arg, "--find-package")) {
- // skip for now
- i++;
- } else if (cmHasLiteralPrefix(arg, "-W")) {
- // skip for now
- } else if (cmHasLiteralPrefix(arg, "--graphviz=")) {
- std::string path = arg.substr(strlen("--graphviz="));
- path = cmSystemTools::CollapseFullPath(path);
- cmSystemTools::ConvertToUnixSlashes(path);
- this->GraphVizFile = path;
- if (this->GraphVizFile.empty()) {
- cmSystemTools::Error("No file specified for --graphviz");
- return;
- }
- } else if (cmHasLiteralPrefix(arg, "--debug-trycompile")) {
- std::cout << "debug trycompile on\n";
- this->DebugTryCompileOn();
- } else if (cmHasLiteralPrefix(arg, "--debug-output")) {
- std::cout << "Running with debug output on.\n";
- this->SetDebugOutputOn(true);
- } else if (cmHasLiteralPrefix(arg, "--log-level=")) {
- const auto logLevel =
- StringToLogLevel(arg.substr(sizeof("--log-level=") - 1));
- if (logLevel == LogLevel::LOG_UNDEFINED) {
- cmSystemTools::Error("Invalid level specified for --log-level");
- return;
- }
- this->SetLogLevel(logLevel);
- this->LogLevelWasSetViaCLI = true;
- } else if (cmHasLiteralPrefix(arg, "--loglevel=")) {
- // This is supported for backward compatibility. This option only
- // appeared in the 3.15.x release series and was renamed to
- // --log-level in 3.16.0
- const auto logLevel =
- StringToLogLevel(arg.substr(sizeof("--loglevel=") - 1));
- if (logLevel == LogLevel::LOG_UNDEFINED) {
- cmSystemTools::Error("Invalid level specified for --loglevel");
- return;
- }
- this->SetLogLevel(logLevel);
- this->LogLevelWasSetViaCLI = true;
- } else if (arg == "--log-context"_s) {
- this->SetShowLogContext(true);
- } else if (cmHasLiteralPrefix(arg, "--debug-find")) {
- std::cout << "Running with debug output on for the `find` commands.\n";
- this->SetDebugFindOutputOn(true);
- } else if (cmHasLiteralPrefix(arg, "--trace-expand")) {
- std::cout << "Running with expanded trace output on.\n";
- this->SetTrace(true);
- this->SetTraceExpand(true);
- } else if (cmHasLiteralPrefix(arg, "--trace-format=")) {
- this->SetTrace(true);
- const auto traceFormat =
- StringToTraceFormat(arg.substr(strlen("--trace-format=")));
- if (traceFormat == TraceFormat::TRACE_UNDEFINED) {
- cmSystemTools::Error("Invalid format specified for --trace-format. "
- "Valid formats are human, json-v1.");
- return;
- }
- this->SetTraceFormat(traceFormat);
- } else if (cmHasLiteralPrefix(arg, "--trace-source=")) {
- std::string file = arg.substr(strlen("--trace-source="));
- cmSystemTools::ConvertToUnixSlashes(file);
- this->AddTraceSource(file);
- this->SetTrace(true);
- } else if (cmHasLiteralPrefix(arg, "--trace-redirect=")) {
- std::string file = arg.substr(strlen("--trace-redirect="));
- cmSystemTools::ConvertToUnixSlashes(file);
- this->SetTraceFile(file);
- this->SetTrace(true);
- } else if (cmHasLiteralPrefix(arg, "--trace")) {
- std::cout << "Running with trace output on.\n";
- this->SetTrace(true);
- this->SetTraceExpand(false);
- } else if (cmHasLiteralPrefix(arg, "--warn-uninitialized")) {
- std::cout << "Warn about uninitialized values.\n";
- this->SetWarnUninitialized(true);
- } else if (cmHasLiteralPrefix(arg, "--warn-unused-vars")) {
- // Option was removed.
- } else if (cmHasLiteralPrefix(arg, "--no-warn-unused-cli")) {
- std::cout << "Not searching for unused variables given on the "
- << "command line.\n";
- this->SetWarnUnusedCli(false);
- } else if (cmHasLiteralPrefix(arg, "--check-system-vars")) {
- std::cout << "Also check system files when warning about unused and "
- << "uninitialized variables.\n";
- this->SetCheckSystemVars(true);
- } else if (cmHasLiteralPrefix(arg, "-A")) {
- std::string value = arg.substr(2);
- if (value.empty()) {
- ++i;
- if (i >= args.size()) {
- cmSystemTools::Error("No platform specified for -A");
- return;
- }
- value = args[i];
- }
- if (havePlatform) {
- cmSystemTools::Error("Multiple -A options not allowed");
- return;
- }
- this->SetGeneratorPlatform(value);
- havePlatform = true;
- } else if (cmHasLiteralPrefix(arg, "-T")) {
- std::string value = arg.substr(2);
- if (value.empty()) {
- ++i;
- if (i >= args.size()) {
- cmSystemTools::Error("No toolset specified for -T");
- return;
- }
- value = args[i];
- }
- if (haveToolset) {
- cmSystemTools::Error("Multiple -T options not allowed");
- return;
- }
- this->SetGeneratorToolset(value);
- haveToolset = true;
- } else if (cmHasLiteralPrefix(arg, "-G")) {
- std::string value = arg.substr(2);
- if (value.empty()) {
- ++i;
- if (i >= args.size()) {
- cmSystemTools::Error("No generator specified for -G");
- this->PrintGeneratorList();
- return;
- }
- value = args[i];
- }
- if (!this->CreateAndSetGlobalGenerator(value, true)) {
- return;
- }
+
#if !defined(CMAKE_BOOTSTRAP)
- } else if (cmHasLiteralPrefix(arg, "--profiling-format=")) {
- profilingFormat = arg.substr(strlen("--profiling-format="));
- if (profilingFormat.empty()) {
- cmSystemTools::Error("No format specified for --profiling-format");
- }
- } else if (cmHasLiteralPrefix(arg, "--profiling-output=")) {
- profilingOutput = arg.substr(strlen("--profiling-output="));
- profilingOutput = cmSystemTools::CollapseFullPath(profilingOutput);
+ arguments.emplace_back("--profiling-format",
+ "No format specified for --profiling-format",
+ CommandArgument::Values::One,
+ [&](std::string const& value, cmake*) -> bool {
+ profilingFormat = value;
+ return true;
+ });
+ arguments.emplace_back(
+ "--profiling-output", "No path specified for --profiling-output",
+ CommandArgument::Values::One,
+ [&](std::string const& value, cmake*) -> bool {
+ profilingOutput = cmSystemTools::CollapseFullPath(value);
cmSystemTools::ConvertToUnixSlashes(profilingOutput);
- if (profilingOutput.empty()) {
- cmSystemTools::Error("No path specified for --profiling-output");
+ return true;
+ });
+ arguments.emplace_back("--preset", "No preset specified for --preset",
+ CommandArgument::Values::One,
+ [&](std::string const& value, cmake*) -> bool {
+ presetName = value;
+ return true;
+ });
+ arguments.emplace_back("--list-presets", CommandArgument::Values::Zero,
+ [&](std::string const&, cmake*) -> bool {
+ listPresets = true;
+ return true;
+ });
+
+#endif
+
+ bool badGeneratorName = false;
+ CommandArgument generatorCommand(
+ "-G", "No generator specified for -G", CommandArgument::Values::One,
+ [&](std::string const& value, cmake* state) -> bool {
+ bool valid = state->CreateAndSetGlobalGenerator(value, true);
+ badGeneratorName = !valid;
+ return valid;
+ });
+
+ for (decltype(args.size()) i = 1; i < args.size(); ++i) {
+ // iterate each argument
+ std::string const& arg = args[i];
+
+ // Generator flag has special handling for when to print help
+ // so it becomes the exception
+ if (generatorCommand.matches(arg)) {
+ bool parsed = generatorCommand.parse(arg, i, args, this);
+ if (!parsed && !badGeneratorName) {
+ this->PrintGeneratorList();
+ return;
}
- } else if (cmHasLiteralPrefix(arg, "--preset=")) {
- presetName = arg.substr(strlen("--preset="));
- if (presetName.empty()) {
- cmSystemTools::Error("No preset specified for --preset");
+ continue;
+ }
+
+ bool matched = false;
+ bool parsedCorrectly = true; // needs to be true so we can ignore
+ // arguments so as -E
+ for (auto const& m : arguments) {
+ if (m.matches(arg)) {
+ matched = true;
+ parsedCorrectly = m.parse(arg, i, args, this);
+ break;
}
- } else if (cmHasLiteralPrefix(arg, "--list-presets")) {
- listPresets = true;
-#endif
}
- // no option assume it is the path to the source or an existing build
- else {
+ if (!parsedCorrectly) {
+ cmSystemTools::Error("Run 'cmake --help' for all supported options.");
+ exit(1);
+ } else if (!matched) {
this->SetDirectoriesFromFile(arg);
}
- // Empty instance, platform and toolset if only a generator is specified
- if (this->GlobalGenerator) {
- this->GeneratorInstance = "";
- if (!this->GeneratorPlatformSet) {
- this->GeneratorPlatform = "";
- }
- if (!this->GeneratorToolsetSet) {
- this->GeneratorToolset = "";
- }
+ }
+
+ // Empty instance, platform and toolset if only a generator is specified
+ if (this->GlobalGenerator) {
+ this->GeneratorInstance = "";
+ if (!this->GeneratorPlatformSet) {
+ this->GeneratorPlatform = "";
+ }
+ if (!this->GeneratorToolsetSet) {
+ this->GeneratorToolset = "";
}
}
@@ -2113,7 +2297,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
#endif
// Add any cache args
if (!this->SetCacheArgs(args)) {
- cmSystemTools::Error("Problem processing arguments. Aborting.\n");
+ cmSystemTools::Error("Run 'cmake --help' for all supported options.");
return -1;
}
#ifndef CMAKE_BOOTSTRAP
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index a611dd7..81374a1 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1167,7 +1167,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args,
return cmcmd::ExecuteLinkScript(args);
}
-#if !defined(CMAKE_BOOTSTRAP) || defined(CMAKE_BOOTSTRAP_NINJA)
+#if !defined(CMAKE_BOOTSTRAP)
// Internal CMake ninja dependency scanning support.
if (args[1] == "cmake_ninja_depends") {
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 328ab7f..6a4a5c5 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3318,9 +3318,17 @@ if(BUILD_TESTING)
endif()
endif()
- find_package(Java COMPONENTS Development QUIET)
- if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW
- AND NOT "${CMAKE_GENERATOR}" MATCHES "Xcode")
+ if(NOT DEFINED CMake_TEST_Java)
+ if(APPLE OR MINGW)
+ set(CMake_TEST_Java 0)
+ else()
+ set(CMake_TEST_Java 1)
+ endif()
+ endif()
+ if(CMake_TEST_Java)
+ find_package(Java COMPONENTS Development QUIET)
+ endif()
+ if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE)
set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM})
ADD_TEST_MACRO(JavaExportImport JavaExportImport)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
index 564169d..c31e4ba 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
+++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
@@ -4,6 +4,7 @@ set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder")
add_library(unknown_lib UNKNOWN IMPORTED)
add_library(static_lib STATIC IMPORTED)
add_library(shared_lib SHARED IMPORTED)
+add_library(interface_lib INTERFACE IMPORTED)
-add_executable(executable main.cpp)
-target_link_libraries(executable unknown_lib static_lib shared_lib)
+add_library(module MODULE module.cpp)
+target_link_libraries(module unknown_lib static_lib shared_lib interface_lib)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
index ba5d936..91a90e5 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
@@ -1,7 +1,17 @@
+^CMake Error in CMakeLists.txt:
+ IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
+ "[^"]+")?.
++
CMake Error in CMakeLists.txt:
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
- ".+")?.
+ "[^"]+")?.
+
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
- ".+")?.
+ "[^"]+")?.(
++
+CMake Error in CMakeLists.txt:
+ IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
+ "[^"]+")?.)*
++
+CMake Generate step failed. Build files cannot be regenerated correctly.$
diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
index 3abca0a..27af911 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
+++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
@@ -1,11 +1,11 @@
-CMake Warning \(dev\) in CMakeLists.txt:
+^CMake Warning \(dev\) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
- ".+")?.
+ "[^"]+")?.
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) in CMakeLists.txt:
@@ -15,7 +15,7 @@ CMake Warning \(dev\) in CMakeLists.txt:
warning.
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
- ".+")?.
+ "[^"]+")?.
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) in CMakeLists.txt:
@@ -25,5 +25,15 @@ CMake Warning \(dev\) in CMakeLists.txt:
warning.
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
- ".+")?.
-This warning is for project developers. Use -Wno-dev to suppress it.
+ "[^"]+")?.
+This warning is for project developers. Use -Wno-dev to suppress it.(
++
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0111 is not set: An imported target missing its location property
+ fails during generation. Run "cmake --help-policy CMP0111" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
+ "[^"]+")?.
+This warning is for project developers. Use -Wno-dev to suppress it.)*$
diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp
deleted file mode 100644
index 5047a34..0000000
--- a/Tests/RunCMake/CMP0111/main.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-int main()
-{
-}
diff --git a/Tests/RunCMake/CMP0111/module.cpp b/Tests/RunCMake/CMP0111/module.cpp
new file mode 100644
index 0000000..b82bb31
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/module.cpp
@@ -0,0 +1,4 @@
+int module()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 57acfab..0b02184 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -172,7 +172,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
-DPSEUDO_BC=$<TARGET_FILE:pseudo_BC>
-DPSEUDO_PURIFY=$<TARGET_FILE:pseudo_purify>
-DPSEUDO_VALGRIND=$<TARGET_FILE:pseudo_valgrind>
- -DPSEUDO_CUDA_MEMCHECK=$<TARGET_FILE:pseudo_cuda-memcheck>
+ -DPSEUDO_CUDA_SANITIZER=$<TARGET_FILE:pseudo_cuda-memcheck>
-DPSEUDO_BC_NOLOG=$<TARGET_FILE:pseudonl_BC>
-DPSEUDO_PURIFY_NOLOG=$<TARGET_FILE:pseudonl_purify>
-DPSEUDO_VALGRIND_NOLOG=$<TARGET_FILE:pseudonl_valgrind>
@@ -514,6 +514,7 @@ endif()
if(XCODE_VERSION)
add_RunCMake_test(XcodeProject -DXCODE_VERSION=${XCODE_VERSION})
+ add_RunCMake_test(XcodeProject-Embed)
# This test can take a very long time due to lots of combinations.
# Use a long default timeout and provide an option to customize it.
@@ -549,10 +550,13 @@ 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 -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
- -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
+ -DCMake_TEST_ISPC=${CMake_TEST_ISPC}
+ -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
add_RunCMake_test(CheckSourceCompiles -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
- -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
-add_RunCMake_test(CheckSourceRuns -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ -DCMake_TEST_ISPC=${CMake_TEST_ISPC}
+ -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
+add_RunCMake_test(CheckSourceRuns -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
+ -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID})
set_property(TEST RunCMake.CheckCompilerFlag
RunCMake.CheckSourceCompiles
RunCMake.CheckSourceRuns
diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt
index aef30d2..a53682d 100644
--- a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: No preset specified for --preset$
+^CMake Error: No preset specified for --preset
+CMake Error: Run 'cmake --help' for all supported options.$
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
index 095fd54..6483f11 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
@@ -2,6 +2,8 @@
enable_language (C)
include(CheckCompilerFlag)
+set(C 1) # test that this is tolerated
+
check_compiler_flag(C "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid C compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake
index a40699c..681a546 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCUDACompilerFlag.cmake
@@ -2,6 +2,8 @@
enable_language (CUDA)
include(CheckCompilerFlag)
+set(CUDA 1) # test that this is tolerated
+
check_compiler_flag(CUDA "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid CUDA compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
index bbc104e..60e9755 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
@@ -2,6 +2,8 @@
enable_language (CXX)
include(CheckCompilerFlag)
+set(CXX 1) # test that this is tolerated
+
check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid CXX compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
index 220ee29..7bb88b1 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
@@ -1,6 +1,8 @@
enable_language (Fortran)
include(CheckCompilerFlag)
+set(Fortran 1) # test that this is tolerated
+
check_compiler_flag(Fortran "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid Fortran compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake
index e9344ca..f250f8d 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCCompilerFlag.cmake
@@ -1,6 +1,8 @@
enable_language (OBJC)
include(CheckCompilerFlag)
+set(OBJC 1) # test that this is tolerated
+
check_compiler_flag(OBJC "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid OBJC compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake
index 503a1de..bc940a6 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckOBJCXXCompilerFlag.cmake
@@ -1,6 +1,8 @@
enable_language (OBJCXX)
include(CheckCompilerFlag)
+set(OBJCXX 1) # test that this is tolerated
+
check_compiler_flag(OBJCXX "-_this_is_not_a_flag_" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid OBJCXX compile flag didn't fail.")
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
index cf46189..4f73622 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckCSourceCompiles.cmake
@@ -2,6 +2,8 @@
enable_language (C)
include(CheckSourceCompiles)
+set(C 1) # test that this is tolerated
+
check_source_compiles(C "I don't build" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid C source didn't fail.")
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake
index 1e6e6b2..2190649 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckCUDASourceCompiles.cmake
@@ -2,6 +2,8 @@
enable_language (CUDA)
include(CheckSourceCompiles)
+set(CUDA 1) # test that this is tolerated
+
check_source_compiles(CUDA "I don't build" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid CUDA source didn't fail.")
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
index ec01d42..97c9c30 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckCXXSourceCompiles.cmake
@@ -2,6 +2,8 @@
enable_language (CXX)
include(CheckSourceCompiles)
+set(CXX 1) # test that this is tolerated
+
check_source_compiles(CXX "I don't build" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "invalid CXX source didn't fail.")
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake
index 1d4e16d..48dc525 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckFortranSourceCompiles.cmake
@@ -3,6 +3,8 @@
enable_language (Fortran)
include(CheckSourceCompiles)
+set(Fortran 1) # test that this is tolerated
+
check_source_compiles(Fortran [=[
PROGRAM TEST_HAVE_PRINT
PRINT *, 'Hello'
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
index 2f53cfc4..76a5009 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCSourceCompiles.cmake
@@ -1,6 +1,8 @@
enable_language (OBJC)
include(CheckSourceCompiles)
+set(OBJC 1) # test that this is tolerated
+
check_source_compiles(OBJC [[
#import <Foundation/Foundation.h>
int main() {
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
index 805d513..814237e 100644
--- a/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
+++ b/Tests/RunCMake/CheckSourceCompiles/CheckOBJCXXSourceCompiles.cmake
@@ -1,6 +1,8 @@
enable_language (OBJCXX)
include(CheckSourceCompiles)
+set(OBJCXX 1) # test that this is tolerated
+
check_source_compiles(OBJCXX [[
#include <vector>
#import <Foundation/Foundation.h>
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
index 3029ac2..96a1027 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckCSourceRuns.cmake
@@ -2,6 +2,8 @@
enable_language (C)
include(CheckSourceRuns)
+set(C 1) # test that this is tolerated
+
check_source_runs(C "int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "C check_source_runs succeeded, but should have failed.")
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake
index 01e5ac8..ea5f4f9 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckCUDASourceRuns.cmake
@@ -2,6 +2,8 @@
enable_language (CUDA)
include(CheckSourceRuns)
+set(CUDA 1) # test that this is tolerated
+
check_source_runs(CUDA "int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "CUDA check_source_runs succeeded, but should have failed.")
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
index d47ddda..c4bef6e 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckCXXSourceRuns.cmake
@@ -2,6 +2,8 @@
enable_language (CXX)
include(CheckSourceRuns)
+set(CXX 1) # test that this is tolerated
+
check_source_runs(CXX "int main() {return 2;}" SHOULD_FAIL)
if(SHOULD_FAIL)
message(SEND_ERROR "CXX check_source_runs succeeded, but should have failed.")
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake
index 2a1fdfe..50e8ec8 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckFortranSourceRuns.cmake
@@ -3,6 +3,8 @@
enable_language (Fortran)
include(CheckSourceRuns)
+set(Fortran 1) # test that this is tolerated
+
check_source_runs(Fortran [=[
PROGRAM TEST_HAVE_PRINT
PRINT *, 'Hello'
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
index 55f28f3..b828352 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCSourceRuns.cmake
@@ -1,6 +1,8 @@
enable_language (OBJC)
include(CheckSourceRuns)
+set(OBJC 1) # test that this is tolerated
+
check_source_runs(OBJC [[
#import <Foundation/Foundation.h>
int main() {
diff --git a/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
index a218acd..8a56f13 100644
--- a/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
+++ b/Tests/RunCMake/CheckSourceRuns/CheckOBJCXXSourceRuns.cmake
@@ -1,6 +1,8 @@
enable_language (OBJCXX)
include(CheckSourceRuns)
+set(OBJCXX 1) # test that this is tolerated
+
check_source_runs(OBJCXX [[
#include <vector>
#import <Foundation/Foundation.h>
diff --git a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt
index 0570d8f..5992dcd 100644
--- a/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/C-no-arg-stderr.txt
@@ -1,2 +1,2 @@
^CMake Error: -C must be followed by a file name.
-CMake Error: Problem processing arguments. Aborting.$
+CMake Error: Run 'cmake --help' for all supported options.$
diff --git a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt
index 5e43bca..8503767 100644
--- a/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/D-no-arg-stderr.txt
@@ -1,2 +1,2 @@
^CMake Error: -D must be followed with VAR=VALUE.
-CMake Error: Problem processing arguments. Aborting.$
+CMake Error: Run 'cmake --help' for all supported options.$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index c438860..bb40c52 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -671,6 +671,10 @@ set(RunCMake_TEST_OPTIONS -Wno-error=deprecated)
run_cmake(Wno-error_deprecated)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Werror=deprecated -Wno-error=deprecated)
+run_cmake(Wno-error_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
# Dev warnings should be on by default
run_cmake(Wdev)
diff --git a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt
index c34ef94..20715cf 100644
--- a/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt
+++ b/Tests/RunCMake/CommandLine/U-no-arg-stderr.txt
@@ -1,2 +1,2 @@
^CMake Error: -U must be followed with VAR.
-CMake Error: Problem processing arguments. Aborting.$
+CMake Error: Run 'cmake --help' for all supported options.$
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
index 0c0f613..139511b 100644
--- a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
+++ b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
@@ -1,2 +1,2 @@
CMake Error: -W must be followed with \[no-\]<name>.
-CMake Error: Problem processing arguments. Aborting.
+CMake Error: Run 'cmake --help' for all supported options.
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt
index cc643df..5d416fc 100644
--- a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt
+++ b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt
@@ -1,2 +1,2 @@
CMake Error: No warning name provided.
-CMake Error: Problem processing arguments. Aborting.
+CMake Error: Run 'cmake --help' for all supported options.
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
index cc643df..5d416fc 100644
--- a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
+++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
@@ -1,2 +1,2 @@
CMake Error: No warning name provided.
-CMake Error: Problem processing arguments. Aborting.
+CMake Error: Run 'cmake --help' for all supported options.
diff --git a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
new file mode 100644
index 0000000..12368a2
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+add_library(empty STATIC empty.c)
+string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
index b540a04..9e7e732 100644
--- a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake)
+run_cmake(CustomCompileRule)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 7d96e50..e8fbd6a 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -152,6 +152,7 @@ function(run_cmake test)
"|Please obtain a new version at"
"|contact PGI Sales at"
+ "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:"
"|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type"
"|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined."
"|[^\n]*is a member of multiple groups"
diff --git a/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt b/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt
new file mode 100644
index 0000000..0400d1a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.19)
+project(${RunCMake_TEST} LANGUAGES C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake
new file mode 100644
index 0000000..9cc03b9
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff-check.cmake
@@ -0,0 +1,14 @@
+function(findAttribute project attr)
+ execute_process(
+ COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
+ OUTPUT_VARIABLE output_var
+ RESULT_VARIABLE result_var
+ )
+
+ if(NOT result_var)
+ set(RunCMake_TEST_FAILED "${attr} attribute is set" PARENT_SCOPE)
+ endif()
+endfunction()
+
+findAttribute(${test} "RemoveHeadersOnCopy")
+findAttribute(${test} "CodeSignOnCopy")
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake
new file mode 100644
index 0000000..f4fe07f
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOff.cmake
@@ -0,0 +1,7 @@
+add_executable(app MACOSX_BUNDLE main.m)
+
+set_target_properties(app PROPERTIES
+ XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}"
+ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY OFF
+ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY OFF
+)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake
new file mode 100644
index 0000000..e4ea55d
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-build-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/sharedFrameworkExt.framework)
+ set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location")
+endif()
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake
new file mode 100644
index 0000000..3f62640
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir-check.cmake
@@ -0,0 +1,14 @@
+function(findAttribute project attr)
+ execute_process(
+ COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
+ OUTPUT_VARIABLE output_var
+ RESULT_VARIABLE result_var
+ )
+
+ if(result_var)
+ set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE)
+ endif()
+endfunction()
+
+findAttribute(${test} "RemoveHeadersOnCopy")
+findAttribute(${test} "CodeSignOnCopy")
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake
new file mode 100644
index 0000000..79d8d77
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnNoSubdir.cmake
@@ -0,0 +1,7 @@
+add_executable(app MACOSX_BUNDLE main.m)
+
+set_target_properties(app PROPERTIES
+ XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}"
+ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON
+ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON
+)
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake
new file mode 100644
index 0000000..57c79ea
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-build-check.cmake
@@ -0,0 +1,3 @@
+if(NOT EXISTS ${RunCMake_TEST_BINARY_DIR}/Debug/app.app/Contents/Frameworks/subdir/sharedFrameworkExt.framework)
+ set(RunCMake_TEST_FAILED "Framework was not embedded at the expected location")
+endif()
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake
new file mode 100644
index 0000000..3f62640
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir-check.cmake
@@ -0,0 +1,14 @@
+function(findAttribute project attr)
+ execute_process(
+ COMMAND grep ${attr} ${RunCMake_TEST_BINARY_DIR}/${project}.xcodeproj/project.pbxproj
+ OUTPUT_VARIABLE output_var
+ RESULT_VARIABLE result_var
+ )
+
+ if(result_var)
+ set(RunCMake_TEST_FAILED "${attr} attribute not set" PARENT_SCOPE)
+ endif()
+endfunction()
+
+findAttribute(${test} "RemoveHeadersOnCopy")
+findAttribute(${test} "CodeSignOnCopy")
diff --git a/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake
new file mode 100644
index 0000000..4c78199
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/EmbedFrameworksFlagsOnWithSubdir.cmake
@@ -0,0 +1,8 @@
+add_executable(app MACOSX_BUNDLE main.m)
+
+set_target_properties(app PROPERTIES
+ XCODE_EMBED_FRAMEWORKS "${EXTERNAL_FWK}"
+ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY ON
+ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY ON
+ XCODE_EMBED_FRAMEWORKS_PATH "subdir"
+)
diff --git a/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake b/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake
new file mode 100644
index 0000000..64e2f95
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/ExternalFramework.cmake
@@ -0,0 +1,2 @@
+add_library(sharedFrameworkExt SHARED func.m)
+set_target_properties(sharedFrameworkExt PROPERTIES FRAMEWORK TRUE)
diff --git a/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
new file mode 100644
index 0000000..0dc1cf3
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/RunCMakeTest.cmake
@@ -0,0 +1,43 @@
+include(RunCMake)
+
+# Build a framework that the other tests will use and treat as external.
+# Always build in the Debug configuration so that the path to the framework
+# is predictable.
+function(ExternalFramework)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalFramework-build)
+ set(externalFramework ${RunCMake_TEST_BINARY_DIR}/Debug/sharedFrameworkExt.framework PARENT_SCOPE)
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(ExternalFramework)
+ run_cmake_command(ExternalFramework-build
+ ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}
+ --config Debug
+ --target sharedFrameworkExt
+ )
+endfunction()
+ExternalFramework()
+
+set(RunCMake_TEST_OPTIONS -DEXTERNAL_FWK=${externalFramework})
+
+run_cmake(EmbedFrameworksFlagsOff)
+
+function(TestFlagsOn testName)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build)
+
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(${testName})
+ run_cmake_command(${testName}-build
+ ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}
+ --config Debug
+ --target app
+ )
+endfunction()
+
+TestFlagsOn(EmbedFrameworksFlagsOnNoSubdir)
+TestFlagsOn(EmbedFrameworksFlagsOnWithSubdir)
diff --git a/Tests/RunCMake/XcodeProject-Embed/func.m b/Tests/RunCMake/XcodeProject-Embed/func.m
new file mode 100644
index 0000000..29c6689
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/func.m
@@ -0,0 +1,6 @@
+#import <CoreFoundation/CoreFoundation.h>
+
+int func()
+{
+ return 1;
+}
diff --git a/Tests/RunCMake/XcodeProject-Embed/main.m b/Tests/RunCMake/XcodeProject-Embed/main.m
new file mode 100644
index 0000000..72e425d
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject-Embed/main.m
@@ -0,0 +1,6 @@
+#import <CoreFoundation/CoreFoundation.h>
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_custom_command/PrintDir.cmake b/Tests/RunCMake/add_custom_command/PrintDir.cmake
new file mode 100644
index 0000000..0a7b646
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/PrintDir.cmake
@@ -0,0 +1 @@
+message(STATUS "WorkingDir='${CMAKE_CURRENT_BINARY_DIR}'")
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 96642fa..aac085d 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -27,3 +27,18 @@ set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
+
+if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
+ run_cmake(WorkingDirectory)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/WorkingDirectory-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake-stdout-file WorkingDirectory-build-multi-config-stdout.txt)
+ else()
+ set(RunCMake-stdout-file WorkingDirectory-build-single-config-stdout.txt)
+ endif()
+ run_cmake_command(WorkingDirectory-build ${CMAKE_COMMAND} --build . --config Debug)
+ unset(RunCMake-stdout-file)
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endif()
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
new file mode 100644
index 0000000..95ecf42
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build/Debug'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
new file mode 100644
index 0000000..1db56ae
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
new file mode 100644
index 0000000..65b7250
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
@@ -0,0 +1,9 @@
+add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
+add_custom_command(
+ OUTPUT out.txt
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake
+ WORKING_DIRECTORY ${CMAKE_CFG_INTDIR}
+ )
+set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
+add_custom_target(drive ALL DEPENDS out.txt)
+add_dependencies(drive mkdir)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-result.txt
index 573541a..573541a 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-result.txt
+++ b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-result.txt
diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stderr.txt
index d302b5c..d302b5c 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt
+++ b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stderr.txt
diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stdout.txt
index 034ee1e..034ee1e 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt
+++ b/Tests/RunCMake/ctest_memcheck/DummyCudaSanitizer-stdout.txt
diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
index 2b3165b..6e0a91c 100644
--- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake
@@ -179,11 +179,11 @@ unset(CTEST_SUFFIX_CODE)
#-----------------------------------------------------------------------------
set(CMAKELISTS_EXTRA_CODE
"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\"
--P \"${RunCMake_SOURCE_DIR}/testCudaMemcheck.cmake\")
+-P \"${RunCMake_SOURCE_DIR}/testCudaSanitizer.cmake\")
")
set(CTEST_SUFFIX_CODE "message(\"Defect count: \${defect_count}\")")
set(CTEST_MEMCHECK_ARGS "DEFECT_COUNT defect_count")
-run_mc_test(DummyCudaMemcheck "${PSEUDO_CUDA_MEMCHECK}")
+run_mc_test(DummyCudaSanitizer "${PSEUDO_CUDA_SANITIZER}")
unset(CTEST_MEMCHECK_ARGS)
unset(CTEST_SUFFIX_CODE)
unset(CTEST_EXTRA_CODE)
diff --git a/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake b/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake
index adc7a1a..adc7a1a 100644
--- a/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake
+++ b/Tests/RunCMake/ctest_memcheck/testCudaSanitizer.cmake
diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt
index 616421e..9de4fc6 100644
--- a/Tests/SetLang/CMakeLists.txt
+++ b/Tests/SetLang/CMakeLists.txt
@@ -15,10 +15,3 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU
add_library(stay stay_c.c stay_cxx.cxx)
set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP")
endif()
-
-if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
- add_library(zoom zoom.zzz)
- set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX)
- target_link_libraries(SetLang zoom)
- target_compile_definitions(SetLang PRIVATE WITH_ZOOM)
-endif()
diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c
index 515e8c2..b934356 100644
--- a/Tests/SetLang/bar.c
+++ b/Tests/SetLang/bar.c
@@ -1,22 +1,10 @@
#include <stdio.h>
int foo();
-
-#ifdef WITH_ZOOM
-int zoom();
-#endif
-
class A
{
public:
- A()
- {
- this->i = foo();
-#ifdef WITH_ZOOM
- i += zoom();
- i -= zoom();
-#endif
- }
+ A() { this->i = foo(); }
int i;
};
diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz
deleted file mode 100644
index a0c8899..0000000
--- a/Tests/SetLang/zoom.zzz
+++ /dev/null
@@ -1,7 +0,0 @@
-int zoom()
-{
- int r = 10;
- r++;
- int ret = r + 10;
- return ret;
-}