summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:50 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:50 +0900
commitc3f4700e938ebc2440ea36c1b9bb69cd4dfe4062 (patch)
tree72ff9a4d28039d39bee7d9c79c1bd6bad5dabda7
parent4109a3583f8051b5c32f09af58eb6b6bef7fad15 (diff)
downloadcmake-c3f4700e938ebc2440ea36c1b9bb69cd4dfe4062.tar.gz
cmake-c3f4700e938ebc2440ea36c1b9bb69cd4dfe4062.tar.bz2
cmake-c3f4700e938ebc2440ea36c1b9bb69cd4dfe4062.zip
Imported Upstream version 3.20.3upstream/3.20.3
-rw-r--r--Help/guide/ide-integration/index.rst6
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake2
-rw-r--r--Modules/CMakeFindBinUtils.cmake22
-rw-r--r--Modules/Compiler/GNU-CXX.cmake9
-rw-r--r--Modules/Compiler/NVHPC-C.cmake9
-rw-r--r--Modules/Compiler/NVHPC-CXX.cmake9
-rw-r--r--Modules/ExternalProject-gitupdate.cmake.in2
-rw-r--r--Modules/ExternalProject.cmake8
-rw-r--r--Modules/FindBoost.cmake4
-rw-r--r--Modules/FindCUDA.cmake2
-rw-r--r--Modules/FindCUDAToolkit.cmake2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmCommandLineArgument.h15
-rw-r--r--Source/cmInstallSubdirectoryGenerator.cxx6
-rw-r--r--Source/cmInstallSubdirectoryGenerator.h1
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx17
-rw-r--r--Source/cmLocalNinjaGenerator.h5
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx30
-rw-r--r--Source/cmNinjaTargetGenerator.cxx25
-rw-r--r--Source/cmNinjaTargetGenerator.h3
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx4
-rw-r--r--Source/cmScanDepFormat.cxx11
-rw-r--r--Source/cmakemain.cxx26
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt2
-rw-r--r--Tests/RunCMake/ExternalProject/FetchGitRefs.cmake (renamed from Tests/RunCMake/ExternalProject/FetchGitTags.cmake)21
-rw-r--r--Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt (renamed from Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt)0
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake7
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake2
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake2
-rw-r--r--Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake2
-rw-r--r--Utilities/Sphinx/conf.py.in1
49 files changed, 214 insertions, 85 deletions
diff --git a/Help/guide/ide-integration/index.rst b/Help/guide/ide-integration/index.rst
index addf93215..779883b96 100644
--- a/Help/guide/ide-integration/index.rst
+++ b/Help/guide/ide-integration/index.rst
@@ -69,9 +69,9 @@ While reading, parsing, and evaluating the contents of ``CMakePresets.json`` is
straightforward, it is not trivial. In addition to the documentation, IDE
vendors may also wish to refer to the CMake source code and test cases for a
better understanding of how to implement the format.
-:download:`This file </manual/presets/schema.json>` provides a machine-readable
-JSON schema for the ``CMakePresets.json`` format that IDE vendors may find
-useful for validation and providing editing assistance.
+:download:`This file <../../manual/presets/schema.json>` provides a
+machine-readable JSON schema for the ``CMakePresets.json`` format that IDE
+vendors may find useful for validation and providing editing assistance.
Configuring
===========
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 1ba537a3e..e7de9cc93 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -181,7 +181,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
# itself, allowing us to support numerous different scattered toolkit layouts
execute_process(COMMAND ${_CUDA_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
- if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ if(_CUDA_NVCC_OUT MATCHES "\\#\\$ TOP=([^\r\n]*)")
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_MATCH_1}" ABSOLUTE)
else()
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index f32266f51..4ce45af6d 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -123,19 +123,19 @@ else()
list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
endif()
-foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
- foreach(_name IN LISTS _CMAKE_${_tool}_NAMES)
+foreach(_CMAKE_TOOL IN LISTS _CMAKE_TOOL_VARS)
+ foreach(_CMAKE_TOOL_NAME IN LISTS _CMAKE_${_CMAKE_TOOL}_NAMES)
if(NOT _CMAKE_TOOLCHAIN_PREFIX STREQUAL "")
if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
- list(PREPEND _CMAKE_${_tool}_NAMES ${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
+ list(PREPEND _CMAKE_${_CMAKE_TOOL}_NAMES ${_CMAKE_TOOL_NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
endif()
- list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name})
+ list(PREPEND _CMAKE_${_CMAKE_TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_CMAKE_TOOL_NAME})
endif()
if(NOT _CMAKE_TOOLCHAIN_SUFFIX STREQUAL "")
- list(PREPEND _CMAKE_${_tool}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_name}${_CMAKE_TOOLCHAIN_SUFFIX})
+ list(PREPEND _CMAKE_${_CMAKE_TOOL}_NAMES ${_CMAKE_TOOLCHAIN_PREFIX}${_CMAKE_TOOL_NAME}${_CMAKE_TOOLCHAIN_SUFFIX})
endif()
endforeach()
- find_program(CMAKE_${_tool} NAMES ${_CMAKE_${_tool}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+ find_program(CMAKE_${_CMAKE_TOOL} NAMES ${_CMAKE_${_CMAKE_TOOL}_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
endforeach()
if(NOT CMAKE_RANLIB)
@@ -154,12 +154,14 @@ if(CMAKE_PLATFORM_HAS_INSTALLNAME)
endif()
# Mark any tool cache entries as advanced.
-foreach(_tool IN LISTS _CMAKE_TOOL_VARS)
- get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${_tool} PROPERTY TYPE)
+foreach(_CMAKE_TOOL IN LISTS _CMAKE_TOOL_VARS)
+ get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${_CMAKE_TOOL} PROPERTY TYPE)
if(_CMAKE_TOOL_CACHED)
- mark_as_advanced(CMAKE_${_tool})
+ mark_as_advanced(CMAKE_${_CMAKE_TOOL})
endif()
- unset(_CMAKE_${_tool}_NAMES)
+ unset(_CMAKE_${_CMAKE_TOOL}_NAMES)
endforeach()
unset(_CMAKE_TOOL_VARS)
unset(_CMAKE_TOOL_CACHED)
+unset(_CMAKE_TOOL_NAME)
+unset(_CMAKE_TOOL)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 758d3c783..b35f25417 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -61,9 +61,14 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1)
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+ set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++23")
+ set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
+elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
endif()
-__compiler_check_default_language_standard(CXX 3.4 98 6.0 14)
+__compiler_check_default_language_standard(CXX 3.4 98 6.0 14 11.1 17)
diff --git a/Modules/Compiler/NVHPC-C.cmake b/Modules/Compiler/NVHPC-C.cmake
index d16c72b76..a734edf19 100644
--- a/Modules/Compiler/NVHPC-C.cmake
+++ b/Modules/Compiler/NVHPC-C.cmake
@@ -1,3 +1,12 @@
include(Compiler/PGI-C)
include(Compiler/NVHPC)
+
+# Needed so that we support `LANGUAGE` property correctly
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
+# Required since as of NVHPC 21.03 the `-MD` flag implicitly
+# implies `-E` and therefore compilation and dependency generation
+# can't occur in the same invocation
+set(CMAKE_C_DEPENDS_EXTRA_COMMANDS "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
+
__compiler_nvhpc(C)
diff --git a/Modules/Compiler/NVHPC-CXX.cmake b/Modules/Compiler/NVHPC-CXX.cmake
index 18ace8bfe..98d002257 100644
--- a/Modules/Compiler/NVHPC-CXX.cmake
+++ b/Modules/Compiler/NVHPC-CXX.cmake
@@ -1,3 +1,12 @@
include(Compiler/PGI-CXX)
include(Compiler/NVHPC)
+
+# Needed so that we support `LANGUAGE` property correctly
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
+# Required since as of NVHPC 21.03 the `-MD` flag implicitly
+# implies `-E` and therefore compilation and dependency generation
+# can't occur in the same invocation
+set(CMAKE_CXX_DEPENDS_EXTRA_COMMANDS "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x c++ -M <SOURCE> -MT <OBJECT> -MD<DEP_FILE>")
+
__compiler_nvhpc(CXX)
diff --git a/Modules/ExternalProject-gitupdate.cmake.in b/Modules/ExternalProject-gitupdate.cmake.in
index 703391805..461e32354 100644
--- a/Modules/ExternalProject-gitupdate.cmake.in
+++ b/Modules/ExternalProject-gitupdate.cmake.in
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5)
function(get_hash_for_ref ref out_var err_var)
execute_process(
- COMMAND "@git_EXECUTABLE@" rev-parse "${ref}"
+ COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^{commit}"
WORKING_DIRECTORY "@work_dir@"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE ref_hash
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 56525080c..90ed1ee63 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2663,9 +2663,11 @@ function(_ep_add_download_command name)
get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
- # Make checkouts quiet when checking out a git hash (this avoids the
- # very noisy detached head message)
- list(PREPEND git_config advice.detachedHead=false)
+ # If git supports it, make checkouts quiet when checking out a git hash.
+ # This avoids the very noisy detached head message.
+ if(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.7)
+ list(PREPEND git_config advice.detachedHead=false)
+ endif()
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index f8887ad2b..d31f925cb 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1350,7 +1350,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.76.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.77.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1622,7 +1622,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.75.0" "1.75" "1.74.0" "1.74"
+ "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 620e32af5..16d75711b 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -839,7 +839,7 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR AND NOT CMAKE_CROSSCOMPILING)
# itself, allowing us to support numerous different scattered toolkit layouts
execute_process(COMMAND ${CUDA_TOOLKIT_ROOT_DIR_NVCC} "-v" "__cmake_determine_cuda"
OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
- if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ if(_CUDA_NVCC_OUT MATCHES "\\#\\$ TOP=([^\r\n]*)")
get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CMAKE_MATCH_1}" ABSOLUTE CACHE)
else()
get_filename_component(CUDA_TOOLKIT_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR_NVCC}" DIRECTORY)
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index de2b06883..8801cb1bf 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -524,7 +524,7 @@ else()
# NVIDIA HPC SDK, and distro's splayed layouts
execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
- if(_CUDA_NVCC_OUT MATCHES "TOP=([^\r\n]*)")
+ if(_CUDA_NVCC_OUT MATCHES "\\#\\$ TOP=([^\r\n]*)")
get_filename_component(CUDAToolkit_BIN_DIR "${CMAKE_MATCH_1}/bin" ABSOLUTE)
else()
get_filename_component(CUDAToolkit_BIN_DIR "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 725b08ee5..4e537759d 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 20)
-set(CMake_VERSION_PATCH 2)
+set(CMake_VERSION_PATCH 3)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
@@ -21,7 +21,7 @@ endif()
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[1ad4501ae9 CMake 3.20.2]==])
+ set(git_info [==[13d112ea03 CMake 3.20.3]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
diff --git a/Source/cmCommandLineArgument.h b/Source/cmCommandLineArgument.h
index 495dc6979..ddfff32f6 100644
--- a/Source/cmCommandLineArgument.h
+++ b/Source/cmCommandLineArgument.h
@@ -25,7 +25,7 @@ struct cmCommandLineArgument
template <typename FunctionType>
cmCommandLineArgument(std::string n, Values t, FunctionType&& func)
- : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n))
+ : InvalidSyntaxMessage(cmStrCat(" is invalid syntax for ", n))
, InvalidValueMessage(cmStrCat("Invalid value used with ", n))
, Name(std::move(n))
, Type(t)
@@ -36,7 +36,7 @@ struct cmCommandLineArgument
template <typename FunctionType>
cmCommandLineArgument(std::string n, std::string failedMsg, Values t,
FunctionType&& func)
- : InvalidSyntaxMessage(cmStrCat("Invalid syntax used with ", n))
+ : InvalidSyntaxMessage(cmStrCat(" is invalid syntax for ", n))
, InvalidValueMessage(std::move(failedMsg))
, Name(std::move(n))
, Type(t)
@@ -98,17 +98,11 @@ struct cmCommandLineArgument
// 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),
- std::forward<CallState>(state)...)
- ? ParseMode::Valid
- : ParseMode::Invalid;
}
}
if (parseState == ParseMode::Valid) {
@@ -150,11 +144,14 @@ struct cmCommandLineArgument
: ParseMode::Invalid;
index = (nextValueIndex - 1);
}
+ } else {
+ parseState = ParseMode::SyntaxError;
}
}
if (parseState == ParseMode::SyntaxError) {
- cmSystemTools::Error(this->InvalidSyntaxMessage);
+ cmSystemTools::Error(
+ cmStrCat("'", input, "'", this->InvalidSyntaxMessage));
} else if (parseState == ParseMode::ValueError) {
cmSystemTools::Error(this->InvalidValueMessage);
}
diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx
index 76806e535..c333bcab2 100644
--- a/Source/cmInstallSubdirectoryGenerator.cxx
+++ b/Source/cmInstallSubdirectoryGenerator.cxx
@@ -14,10 +14,10 @@
#include "cmSystemTools.h"
cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator(
- cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll,
+ cmMakefile* makefile, std::string binaryDirectory,
cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault,
- excludeFromAll, std::move(backtrace))
+ false, std::move(backtrace))
, Makefile(makefile)
, BinaryDirectory(std::move(binaryDirectory))
{
@@ -52,7 +52,7 @@ bool cmInstallSubdirectoryGenerator::Compute(cmLocalGenerator* lg)
void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os)
{
- if (!this->ExcludeFromAll) {
+ if (!this->Makefile->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
cmPolicies::PolicyStatus status =
this->LocalGenerator->GetPolicyStatus(cmPolicies::CMP0082);
switch (status) {
diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h
index 614cef921..f174d07c4 100644
--- a/Source/cmInstallSubdirectoryGenerator.h
+++ b/Source/cmInstallSubdirectoryGenerator.h
@@ -21,7 +21,6 @@ class cmInstallSubdirectoryGenerator : public cmInstallGenerator
public:
cmInstallSubdirectoryGenerator(cmMakefile* makefile,
std::string binaryDirectory,
- bool excludeFromAll,
cmListFileBacktrace backtrace);
~cmInstallSubdirectoryGenerator() override;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 73b6fbcf6..dcf590a14 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1877,7 +1877,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
if (!archs.empty() &&
- (lang == "C" || lang == "CXX" || lang == "OBJ" || lang == "OBJCXX" ||
+ (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX" ||
lang == "ASM")) {
for (std::string const& arch : archs) {
if (filterArch.empty() || filterArch == arch) {
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 51ad99389..081cc41fc 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -407,7 +407,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(
}
std::string cmLocalNinjaGenerator::WriteCommandScript(
- std::vector<std::string> const& cmdLines, std::string const& customStep,
+ std::vector<std::string> const& cmdLines, std::string const& outputConfig,
+ std::string const& commandConfig, std::string const& customStep,
cmGeneratorTarget const* target) const
{
std::string scriptPath;
@@ -416,9 +417,13 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
} else {
scriptPath = cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles");
}
+ scriptPath += this->GetGlobalNinjaGenerator()->ConfigDirectory(outputConfig);
cmSystemTools::MakeDirectory(scriptPath);
scriptPath += '/';
scriptPath += customStep;
+ if (this->GlobalGenerator->IsMultiConfig()) {
+ scriptPath += cmStrCat('-', commandConfig);
+ }
#ifdef _WIN32
scriptPath += ".bat";
#else
@@ -461,7 +466,8 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
}
std::string cmLocalNinjaGenerator::BuildCommandLine(
- std::vector<std::string> const& cmdLines, std::string const& customStep,
+ std::vector<std::string> const& cmdLines, std::string const& outputConfig,
+ std::string const& commandConfig, std::string const& customStep,
cmGeneratorTarget const* target) const
{
// If we have no commands but we need to build a command anyway, use noop.
@@ -480,8 +486,8 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
cmdLinesTotal += cmd.length() + 6;
}
if (cmdLinesTotal > cmSystemTools::CalculateCommandLineLengthLimit() / 2) {
- std::string const scriptPath =
- this->WriteCommandScript(cmdLines, customStep, target);
+ std::string const scriptPath = this->WriteCommandScript(
+ cmdLines, outputConfig, commandConfig, customStep, target);
std::string cmd
#ifndef _WIN32
= "/bin/sh "
@@ -694,7 +700,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
}
gg->WriteCustomCommandBuild(
- this->BuildCommandLine(cmdLines, customStep),
+ this->BuildCommandLine(cmdLines, ccg.GetOutputConfig(), fileConfig,
+ customStep),
this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0],
depfile, cc->GetJobPool(), cc->GetUsesTerminal(),
/*restat*/ !symbolic || !byproducts.empty(), ninjaOutputs, fileConfig,
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 5b850f3d0..0734c5cad 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -60,7 +60,8 @@ public:
}
std::string BuildCommandLine(
- std::vector<std::string> const& cmdLines,
+ std::vector<std::string> const& cmdLines, std::string const& outputConfig,
+ std::string const& commandConfig,
std::string const& customStep = std::string(),
cmGeneratorTarget const* target = nullptr) const;
@@ -119,6 +120,8 @@ private:
std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg);
std::string WriteCommandScript(std::vector<std::string> const& cmdLines,
+ std::string const& outputConfig,
+ std::string const& commandConfig,
std::string const& customStep,
cmGeneratorTarget const* target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 78cae0e98..dd254063c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1844,7 +1844,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
}
this->AddInstallGenerator(cm::make_unique<cmInstallSubdirectoryGenerator>(
- subMf, binPath, excludeFromAll, this->GetBacktrace()));
+ subMf, binPath, this->GetBacktrace()));
}
const std::string& cmMakefile::GetCurrentSourceDirectory() const
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 49e5e4cc6..1597d2c19 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -287,7 +287,8 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
// If there is no ranlib the command will be ":". Skip it.
cm::erase_if(linkCmds, cmNinjaRemoveNoOpCommands());
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(linkCmds);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(linkCmds, config, config);
// Write the linker rule with response file if needed.
rule.Comment =
@@ -310,7 +311,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
cmNinjaRule rule(this->LanguageLinkerCudaDeviceRule(config));
rule.Command = this->GetLocalGenerator()->BuildCommandLine(
{ cmStrCat(mf->GetRequiredDefinition("CMAKE_CUDA_DEVICE_LINKER"),
- " -arch=$ARCH $REGISTER -o=$out $in") });
+ " -arch=$ARCH $REGISTER -o=$out $in") },
+ config, config);
rule.Comment = "Rule for CUDA device linking.";
rule.Description = "Linking CUDA $out";
this->GetGlobalGenerator()->AddRule(rule);
@@ -336,7 +338,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
compileCmd, vars);
rule.Name = this->LanguageLinkerCudaDeviceCompileRule(config);
- rule.Command = this->GetLocalGenerator()->BuildCommandLine({ compileCmd });
+ rule.Command = this->GetLocalGenerator()->BuildCommandLine({ compileCmd },
+ config, config);
rule.Comment = "Rule for compiling CUDA device stubs.";
rule.Description = "Compiling CUDA device stub $out";
this->GetGlobalGenerator()->AddRule(rule);
@@ -345,7 +348,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRules(
rule.Command = this->GetLocalGenerator()->BuildCommandLine(
{ cmStrCat(mf->GetRequiredDefinition("CMAKE_CUDA_FATBINARY"),
" -64 -cmdline=--compile-only -compress-all -link "
- "--embedded-fatbin=$out $PROFILES") });
+ "--embedded-fatbin=$out $PROFILES") },
+ config, config);
rule.Comment = "Rule for CUDA fatbinaries.";
rule.Description = "Creating fatbinary $out";
this->GetGlobalGenerator()->AddRule(rule);
@@ -475,7 +479,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
linkCmds.emplace_back("$POST_BUILD");
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(linkCmds);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(linkCmds, config, config);
// Write the linker rule with response file if needed.
rule.Comment =
@@ -500,7 +505,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
std::vector<std::string> cmd;
cmd.push_back(cmakeCommand + " -E cmake_symlink_executable $in $out");
cmd.emplace_back("$POST_BUILD");
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(cmd);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(cmd, config, config);
}
rule.Description = "Creating executable symlink $out";
rule.Comment = "Rule for creating executable symlink.";
@@ -512,7 +518,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
cmd.push_back(cmakeCommand +
" -E cmake_symlink_library $in $SONAME $out");
cmd.emplace_back("$POST_BUILD");
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(cmd);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(cmd, config, config);
}
rule.Description = "Creating library symlink $out";
rule.Comment = "Rule for creating library symlink.";
@@ -1310,10 +1317,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
preLinkCmdLines.push_back("cd " + homeOutDir);
}
- vars["PRE_LINK"] = localGen.BuildCommandLine(preLinkCmdLines, "pre-link",
- this->GeneratorTarget);
- std::string postBuildCmdLine = localGen.BuildCommandLine(
- postBuildCmdLines, "post-build", this->GeneratorTarget);
+ vars["PRE_LINK"] = localGen.BuildCommandLine(
+ preLinkCmdLines, config, fileConfig, "pre-link", this->GeneratorTarget);
+ std::string postBuildCmdLine =
+ localGen.BuildCommandLine(postBuildCmdLines, config, fileConfig,
+ "post-build", this->GeneratorTarget);
cmNinjaVars symlinkVars;
bool const symlinkNeeded =
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 672b5797e..b4838d667 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -537,7 +537,8 @@ cmNinjaRule GetScanRule(
cmRulePlaceholderExpander::RuleVariables const& vars,
const std::string& responseFlag, const std::string& flags,
cmRulePlaceholderExpander* const rulePlaceholderExpander,
- cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds)
+ cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds,
+ const std::string& outputConfig)
{
cmNinjaRule rule(ruleName);
// Scanning always uses a depfile for preprocessor dependencies.
@@ -578,7 +579,8 @@ cmNinjaRule GetScanRule(
for (std::string& scanCmd : scanCmds) {
rulePlaceholderExpander->ExpandRuleVariables(generator, scanCmd, scanVars);
}
- rule.Command = generator->BuildCommandLine(scanCmds);
+ rule.Command =
+ generator->BuildCommandLine(scanCmds, outputConfig, outputConfig);
return rule;
}
@@ -670,7 +672,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
auto scanRule = GetScanRule(
scanRuleName, vars, responseFlag, flags, rulePlaceholderExpander.get(),
- this->GetLocalGenerator(), std::move(scanCommands));
+ this->GetLocalGenerator(), std::move(scanCommands), config);
scanRule.Comment =
cmStrCat("Rule for generating ", lang, " dependencies.");
@@ -700,7 +702,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
auto scanRule = GetScanRule(
scanRuleName, vars, "", flags, rulePlaceholderExpander.get(),
- this->GetLocalGenerator(), std::move(scanCommands));
+ this->GetLocalGenerator(), std::move(scanCommands), config);
// Write the rule for generating dependencies for the given language.
scanRule.Comment = cmStrCat("Rule for generating ", lang,
@@ -732,7 +734,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
ddModmapArg, " --dd=$out @", rule.RspFile);
ddCmds.emplace_back(std::move(ccmd));
}
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(ddCmds);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(ddCmds, config, config);
}
rule.Comment =
cmStrCat("Rule to generate ninja dyndep files for ", lang, '.');
@@ -928,7 +931,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
vars);
}
- rule.Command = this->GetLocalGenerator()->BuildCommandLine(compileCmds);
+ rule.Command =
+ this->GetLocalGenerator()->BuildCommandLine(compileCmds, config, config);
// Write the rule for compiling file of the given language.
rule.Comment = cmStrCat("Rule for compiling ", lang, " files.");
@@ -1246,7 +1250,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
this->ExportObjectCompileCommand(
language, sourceFileName, objectDir, objectFileName, objectFileDir,
- vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"]);
+ vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config);
objBuild.Outputs.push_back(objectFileName);
if (firstForConfig) {
@@ -1617,7 +1621,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
std::string const& language, std::string const& sourceFileName,
std::string const& objectDir, std::string const& objectFileName,
std::string const& objectFileDir, std::string const& flags,
- std::string const& defines, std::string const& includes)
+ std::string const& defines, std::string const& includes,
+ std::string const& outputConfig)
{
if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) {
return;
@@ -1679,8 +1684,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
compileObjectVars);
}
- std::string cmdLine =
- this->GetLocalGenerator()->BuildCommandLine(compileCmds);
+ std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(
+ compileCmds, outputConfig, outputConfig);
this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, sourceFileName);
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 79dc6227e..3a28cef94 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -162,7 +162,8 @@ protected:
std::string const& language, std::string const& sourceFileName,
std::string const& objectDir, std::string const& objectFileName,
std::string const& objectFileDir, std::string const& flags,
- std::string const& defines, std::string const& includes);
+ std::string const& defines, std::string const& includes,
+ std::string const& outputConfig);
void AdditionalCleanFiles(const std::string& config);
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 92c5b521b..7a04c470b 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -139,8 +139,8 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
gg->WriteBuild(this->GetCommonFileStream(), phonyBuild);
}
} else {
- std::string command =
- lg->BuildCommandLine(commands, "utility", this->GeneratorTarget);
+ std::string command = lg->BuildCommandLine(
+ commands, config, fileConfig, "utility", this->GeneratorTarget);
std::string desc;
cmProp echoStr = genTarget->GetProperty("EchoString");
if (echoStr) {
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
index e0460694e..f988fe45f 100644
--- a/Source/cmScanDepFormat.cxx
+++ b/Source/cmScanDepFormat.cxx
@@ -69,7 +69,7 @@ static Json::Value EncodeFilename(std::string const& path)
return false; \
} \
\
- if (!cmSystemTools::FileIsFullPath(res)) { \
+ if (!work_directory.empty() && !cmSystemTools::FileIsFullPath(res)) { \
res = cmStrCat(work_directory, '/', res); \
} \
} while (0)
@@ -105,15 +105,16 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, cmSourceInfo* info)
}
for (auto const& rule : rules) {
+ std::string work_directory;
Json::Value const& workdir = rule["work-directory"];
- if (!workdir.isString()) {
+ if (workdir.isString()) {
+ PARSE_BLOB(workdir, work_directory);
+ } else if (!workdir.isNull()) {
cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep 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()) {
@@ -203,8 +204,6 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
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));
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 88ba0116c..ad648186b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -532,11 +532,22 @@ int do_build(int ac, char const* const* av)
for (; i < inputArgs.size() && !nativeOptionsPassed; ++i) {
std::string const& arg = inputArgs[i];
+ bool matched = false;
+ bool parsed = false;
for (auto const& m : arguments) {
- if (m.matches(arg) && m.parse(arg, i, inputArgs)) {
+ matched = m.matches(arg);
+ if (matched) {
+ parsed = m.parse(arg, i, inputArgs);
break;
}
}
+ if (!(matched && parsed)) {
+ dir.clear();
+ if (!matched) {
+ std::cerr << "Unknown argument " << arg << std::endl;
+ }
+ break;
+ }
}
if (nativeOptionsPassed) {
@@ -806,11 +817,22 @@ int do_install(int ac, char const* const* av)
for (decltype(inputArgs.size()) i = 0; i < inputArgs.size(); ++i) {
std::string const& arg = inputArgs[i];
+ bool matched = false;
+ bool parsed = false;
for (auto const& m : arguments) {
- if (m.matches(arg) && m.parse(arg, i, inputArgs)) {
+ matched = m.matches(arg);
+ if (matched) {
+ parsed = m.parse(arg, i, inputArgs);
break;
}
}
+ if (!(matched && parsed)) {
+ dir.clear();
+ if (!matched) {
+ std::cerr << "Unknown argument " << arg << std::endl;
+ }
+ break;
+ }
}
}
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 8072a2cad..caf3c8896 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -54,6 +54,14 @@ run_cmake_command(build-no-dir
${CMAKE_COMMAND} --build)
run_cmake_command(build-no-cache
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
+run_cmake_command(build-unknown-command-short
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} -invalid-command)
+run_cmake_command(build-unknown-command-long
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --invalid-command)
+run_cmake_command(build-unknown-command-partial-match
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --targetinvalid)
+run_cmake_command(build-invalid-target-syntax
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --target=invalid)
run_cmake_command(build-no-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
run_cmake_command(build-bad-dir
@@ -65,6 +73,10 @@ run_cmake_command(install-no-dir
${CMAKE_COMMAND} --install)
run_cmake_command(install-bad-dir
${CMAKE_COMMAND} --install dir-does-not-exist)
+run_cmake_command(install-unknown-command-short
+ ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} -invalid-command)
+run_cmake_command(install-unknown-command-long
+ ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} --invalid-command)
run_cmake_command(install-options-to-vars
${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars
--strip --prefix /var/test --config sample --component pack)
diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt
new file mode 100644
index 000000000..5fe25390a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: '--target=invalid' is invalid syntax for --target
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt
new file mode 100644
index 000000000..c8f1a03cb
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument --invalid-command
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt
new file mode 100644
index 000000000..d69338a41
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: '--targetinvalid' is invalid syntax for --target
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt
new file mode 100644
index 000000000..a6cfeceac
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument -invalid-command
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt
new file mode 100644
index 000000000..e6cee6b45
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument --invalid-command
+Usage: cmake --install <dir> \[options\]
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt
new file mode 100644
index 000000000..f690ec430
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument -invalid-command
+Usage: cmake --install <dir> \[options\]
diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake
index 37d1b4088..a00908b39 100644
--- a/Tests/RunCMake/ExternalProject/FetchGitTags.cmake
+++ b/Tests/RunCMake/ExternalProject/FetchGitRefs.cmake
@@ -11,7 +11,7 @@ file(MAKE_DIRECTORY ${srcDir})
file(GLOB entries ${srcRepo}/*)
file(REMOVE_RECURSE ${entries} ${binDir})
file(TOUCH ${srcRepo}/firstFile.txt)
-configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitTags/CMakeLists.txt
+configure_file(${CMAKE_CURRENT_LIST_DIR}/FetchGitRefs/CMakeLists.txt
${srcDir}/CMakeLists.txt COPYONLY)
function(execGitCommand)
@@ -63,5 +63,22 @@ execGitCommand(commit -m "Second file")
execGitCommand(tag -a -m "Adding tag" tag_of_interest)
execGitCommand(reset --hard HEAD~1)
-message(STATUS "Second configure-and-build")
+message(STATUS "Configure-and-build, update to tag")
configureAndBuild(tag_of_interest)
+
+# Do the same, but this time for a commit hash
+file(TOUCH ${srcRepo}/thirdFile.txt)
+execGitCommand(add thirdFile.txt)
+execGitCommand(commit -m "Third file")
+execGitCommand(tag -a -m "Adding another tag" check_for_hash)
+execGitCommand(reset --hard HEAD~1)
+execute_process(
+ WORKING_DIRECTORY ${srcRepo}
+ COMMAND ${GIT_EXECUTABLE} rev-parse check_for_hash
+ COMMAND_ERROR_IS_FATAL ANY
+ OUTPUT_VARIABLE commit_hash
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+message(STATUS "Configure-and-build, update to commit hash ${commit_hash}")
+configureAndBuild(${commit_hash})
diff --git a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt
index d9a380c03..d9a380c03 100644
--- a/Tests/RunCMake/ExternalProject/FetchGitTags/CMakeLists.txt
+++ b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 3205dd54c..a4244e364 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -185,6 +185,6 @@ if(GIT_EXECUTABLE)
# Note that there appear to be differences in where git writes its output to
# on some platforms. It may go to stdout or stderr, so force it to be merged.
set(RunCMake_TEST_OUTPUT_MERGE TRUE)
- run_cmake(FetchGitTags)
+ run_cmake(FetchGitRefs)
set(RunCMake_TEST_OUTPUT_MERGE FALSE)
endif()
diff --git a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt
new file mode 100644
index 000000000..628b6bc33
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine-release-config-build-stdout.txt
@@ -0,0 +1,2 @@
+
+Post-build Debug Release \.*$
diff --git a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake
index 00aa896af..de528be46 100644
--- a/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/LongCommandLine.cmake
@@ -14,3 +14,10 @@ add_custom_target(
ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gen.txt"
)
+
+add_executable(exe main.c)
+
+add_custom_command(
+ TARGET exe POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "Post-build $<CONFIG> $<COMMAND_CONFIG:$<CONFIG>> ${very_long}"
+ )
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index aa427391e..e7acbc284 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -198,8 +198,11 @@ run_cmake_build(PostBuild release Release Exe)
run_cmake_build(PostBuild debug-in-release-graph Release Exe:Debug)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LongCommandLine-build)
+set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
run_cmake_configure(LongCommandLine)
+unset(RunCMake_TEST_OPTIONS)
run_cmake_build(LongCommandLine release Release custom)
+run_cmake_build(LongCommandLine release-config Release exe:Debug)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Framework-build)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all")
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt
index 1bd7f495b..32bb1a96b 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-ExcludeFromAll/CMakeLists.txt
@@ -1 +1,2 @@
install(CODE "message(STATUS \"exclude\")")
+set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE)
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake
index 56c1b81f7..8ebf21b3d 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW.cmake
@@ -1,3 +1,3 @@
add_subdirectory(CMP0082)
-add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
+add_subdirectory(CMP0082-ExcludeFromAll)
install(CODE "message(STATUS \"top\")")
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake
index 56c1b81f7..8ebf21b3d 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD.cmake
@@ -1,3 +1,3 @@
add_subdirectory(CMP0082)
-add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
+add_subdirectory(CMP0082-ExcludeFromAll)
install(CODE "message(STATUS \"top\")")
diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake
index 56c1b81f7..8ebf21b3d 100644
--- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake
+++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN.cmake
@@ -1,3 +1,3 @@
add_subdirectory(CMP0082)
-add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
+add_subdirectory(CMP0082-ExcludeFromAll)
install(CODE "message(STATUS \"top\")")
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index 5def681dc..c383828bd 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -53,6 +53,7 @@ for fpath in cmake_manuals:
except Exception as e:
sys.stderr.write("ERROR: %s\n" % str(e))
man_show_urls = False
+man_make_section_directory = False
html_show_sourcelink = True
html_static_path = ['@conf_path@/static']