summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--.gitlab/ci/configure_cuda10.2_clang.cmake3
-rw-r--r--.gitlab/ci/configure_debian10_ninja_clang.cmake1
-rw-r--r--.gitlab/ci/docker/cuda10.2/Dockerfile4
-rwxr-xr-x.gitlab/ci/docker/cuda10.2/install_deps.sh1
-rw-r--r--.gitlab/ci/docker/cuda10.2/llvm-snapshot.gpg.key52
-rw-r--r--.gitlab/ci/docker/cuda10.2/llvm.list2
-rw-r--r--.gitlab/ci/env_cuda10.2_clang.sh3
-rw-r--r--.gitlab/ci/env_debian10_ninja_clang.sh2
-rw-r--r--.gitlab/os-linux.yml15
-rw-r--r--.gitlab/os-macos.yml12
-rw-r--r--Modules/Compiler/AppleClang-C.cmake12
-rw-r--r--Modules/FindLATEX.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCommands.cxx14
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx37
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx17
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h5
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx17
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.h2
-rw-r--r--Source/cmScanDepFormat.cxx19
-rw-r--r--Source/cmState.cxx9
-rw-r--r--Source/cmState.h2
-rw-r--r--Tests/RunCMake/Syntax/OverrideProject-result.txt1
-rw-r--r--Tests/RunCMake/Syntax/OverrideProject-stderr.txt3
-rw-r--r--Tests/RunCMake/Syntax/RunCMakeTest.cmake1
26 files changed, 216 insertions, 44 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3765abc..d224088 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -176,6 +176,16 @@ test:debian10-aarch64-ninja:
variables:
CMAKE_CI_NO_MR: "true"
+test:debian10-ninja-clang:
+ extends:
+ - .debian10_ninja_clang
+ - .cmake_test_linux_release
+ - .linux_builder_tags_qt
+ - .run_manually
+ - .needs_centos6_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
test:debian10-makefiles-clang:
extends:
- .debian10_makefiles_clang
@@ -214,6 +224,16 @@ test:cuda10.2-nvidia:
- .run_dependent
- .needs_centos6_x86_64
+test:cuda10.2-clang:
+ extends:
+ - .cuda10.2_clang
+ - .cmake_test_linux_release
+ - .linux_builder_tags_cuda
+ - .run_dependent
+ - .needs_centos6_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
build:fedora34-ninja:
extends:
- .fedora34_ninja
diff --git a/.gitlab/ci/configure_cuda10.2_clang.cmake b/.gitlab/ci/configure_cuda10.2_clang.cmake
new file mode 100644
index 0000000..e13ca88
--- /dev/null
+++ b/.gitlab/ci/configure_cuda10.2_clang.cmake
@@ -0,0 +1,3 @@
+set(CMake_TEST_CUDA "Clang" CACHE STRING "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_debian10_ninja_clang.cmake b/.gitlab/ci/configure_debian10_ninja_clang.cmake
new file mode 100644
index 0000000..20863a2
--- /dev/null
+++ b/.gitlab/ci/configure_debian10_ninja_clang.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/docker/cuda10.2/Dockerfile b/.gitlab/ci/docker/cuda10.2/Dockerfile
index e0ea0e7..b6f37b5 100644
--- a/.gitlab/ci/docker/cuda10.2/Dockerfile
+++ b/.gitlab/ci/docker/cuda10.2/Dockerfile
@@ -1,5 +1,9 @@
FROM nvidia/cuda:10.2-devel-ubuntu18.04
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
+COPY llvm.list /etc/apt/sources.list.d/llvm.list
+COPY llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key
+RUN apt-key add /root/llvm-snapshot.gpg.key
+
COPY install_deps.sh /root/install_deps.sh
RUN sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/cuda10.2/install_deps.sh b/.gitlab/ci/docker/cuda10.2/install_deps.sh
index 0d57cd3..6d53997 100755
--- a/.gitlab/ci/docker/cuda10.2/install_deps.sh
+++ b/.gitlab/ci/docker/cuda10.2/install_deps.sh
@@ -7,6 +7,7 @@ apt-get update
# Install development tools.
apt-get install -y \
g++ \
+ clang-11 \
curl \
git
diff --git a/.gitlab/ci/docker/cuda10.2/llvm-snapshot.gpg.key b/.gitlab/ci/docker/cuda10.2/llvm-snapshot.gpg.key
new file mode 100644
index 0000000..aa6b105
--- /dev/null
+++ b/.gitlab/ci/docker/cuda10.2/llvm-snapshot.gpg.key
@@ -0,0 +1,52 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.12 (GNU/Linux)
+
+mQINBFE9lCwBEADi0WUAApM/mgHJRU8lVkkw0CHsZNpqaQDNaHefD6Rw3S4LxNmM
+EZaOTkhP200XZM8lVdbfUW9xSjA3oPldc1HG26NjbqqCmWpdo2fb+r7VmU2dq3NM
+R18ZlKixiLDE6OUfaXWKamZsXb6ITTYmgTO6orQWYrnW6ckYHSeaAkW0wkDAryl2
+B5v8aoFnQ1rFiVEMo4NGzw4UX+MelF7rxaaregmKVTPiqCOSPJ1McC1dHFN533FY
+Wh/RVLKWo6npu+owtwYFQW+zyQhKzSIMvNujFRzhIxzxR9Gn87MoLAyfgKEzrbbT
+DhqqNXTxS4UMUKCQaO93TzetX/EBrRpJj+vP640yio80h4Dr5pAd7+LnKwgpTDk1
+G88bBXJAcPZnTSKu9I2c6KY4iRNbvRz4i+ZdwwZtdW4nSdl2792L7Sl7Nc44uLL/
+ZqkKDXEBF6lsX5XpABwyK89S/SbHOytXv9o4puv+65Ac5/UShspQTMSKGZgvDauU
+cs8kE1U9dPOqVNCYq9Nfwinkf6RxV1k1+gwtclxQuY7UpKXP0hNAXjAiA5KS5Crq
+7aaJg9q2F4bub0mNU6n7UI6vXgu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WAgG
+5VPEgIAVhJ6RTZ26i/G+4J8neKyRs4vz+57UGwY6zI4AB1ZcWGEE3Bf+CDEDgmnP
+LSwbnHefK9IljT9XU98PelSryUO/5UPw7leE0akXKB4DtekToO226px1VnGp3Bov
+1GBGvpHvL2WizEwdk+nfk8LtrLzej+9FtIcq3uIrYnsac47Pf7p0otcFeTJTjSq3
+krCaoG4Hx0zGQG2ZFpHrSrZTVy6lxvIdfi0beMgY6h78p6M9eYZHQHc02DjFkQXN
+bXb5c6gCHESH5PXwPU4jQEE7Ib9J6sbk7ZT2Mw==
+=j+4q
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/.gitlab/ci/docker/cuda10.2/llvm.list b/.gitlab/ci/docker/cuda10.2/llvm.list
new file mode 100644
index 0000000..79f8265
--- /dev/null
+++ b/.gitlab/ci/docker/cuda10.2/llvm.list
@@ -0,0 +1,2 @@
+deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main
+deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main
diff --git a/.gitlab/ci/env_cuda10.2_clang.sh b/.gitlab/ci/env_cuda10.2_clang.sh
new file mode 100644
index 0000000..d3b2530
--- /dev/null
+++ b/.gitlab/ci/env_cuda10.2_clang.sh
@@ -0,0 +1,3 @@
+export CC=/usr/bin/clang-11
+export CXX=/usr/bin/clang++-11
+export CUDACXX=/usr/bin/clang++-11
diff --git a/.gitlab/ci/env_debian10_ninja_clang.sh b/.gitlab/ci/env_debian10_ninja_clang.sh
new file mode 100644
index 0000000..e0d5d61
--- /dev/null
+++ b/.gitlab/ci/env_debian10_ninja_clang.sh
@@ -0,0 +1,2 @@
+export CC=/usr/bin/clang-7
+export CXX=/usr/bin/clang++-7
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index 6b490be..06b98cc 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -158,6 +158,12 @@
CMAKE_CONFIGURATION: debian10_makefiles_clang
CMAKE_GENERATOR: "Unix Makefiles"
+.debian10_ninja_clang:
+ extends: .debian10
+
+ variables:
+ CMAKE_CONFIGURATION: debian10_ninja_clang
+
### Sanitizers
.fedora_memcheck:
@@ -203,7 +209,7 @@
### CUDA builds
.cuda10.2:
- image: "kitware/cmake:ci-cuda10.2-x86_64-2020-06-11"
+ image: "kitware/cmake:ci-cuda10.2-x86_64-2021-06-16"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -217,6 +223,13 @@
CMAKE_CONFIGURATION: cuda10.2_nvidia
CTEST_NO_WARNINGS_ALLOWED: 1
+.cuda10.2_clang:
+ extends: .cuda10.2
+
+ variables:
+ CMAKE_CONFIGURATION: cuda10.2_clang
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
## Tags
.linux_builder_tags:
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 1ce96b3..9c4a920 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-12.4.app/Contents/Developer"
+ DEVELOPER_DIR: "/Applications/Xcode-12.5.app/Contents/Developer"
# Avoid conflicting with other projects running on the same machine.
SCCACHE_SERVER_PORT: 4227
@@ -87,7 +87,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.4
+ - xcode-12.5
- nonconcurrent
.macos_x86_64_builder_tags_package:
@@ -95,7 +95,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.4
+ - xcode-12.5
- nonconcurrent
- finder
@@ -104,7 +104,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos
- shell
- - xcode-12.4
+ - xcode-12.5
- concurrent
.macos_arm64_builder_tags:
@@ -112,7 +112,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-12.4
+ - xcode-12.5
- nonconcurrent
.macos_arm64_builder_ext_tags:
@@ -120,7 +120,7 @@
- cmake # Since this is a bare runner, pin to a project.
- macos-arm64
- shell
- - xcode-12.4
+ - xcode-12.5
- concurrent
## macOS-specific scripts
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index bd98193..d711b6e 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -28,4 +28,14 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()
-__compiler_check_default_language_standard(C 4.0 99)
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+endif()
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.3)
+ set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
+ set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+endif()
+
+__compiler_check_default_language_standard(C 4.0 99 9.1 11 12.0.5 17)
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 1e82651..9d7168e 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -61,6 +61,10 @@ if (WIN32)
# Try to find the MikTex binary path (look for its package manager).
find_path(MIKTEX_BINARY_PATH mpm.exe
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
+ "$ENV{LOCALAPPDATA}/Programs/MiKTeX/miktex/bin"
+ "$ENV{LOCALAPPDATA}/Programs/MiKTeX/miktex/bin/x64"
+ "$ENV{APPDATA}/Programs/MiKTeX/miktex/bin"
+ "$ENV{APPDATA}/Programs/MiKTeX/miktex/bin/x64"
DOC
"Path to the MikTex binary directory."
)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 6be7511..46e94f1 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 20210615)
+set(CMake_VERSION_PATCH 20210617)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 9e5b783..a241a3a 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -164,36 +164,36 @@ void GetScriptingCommands(cmState* state)
state->AddBuiltinCommand("string", cmStringCommand);
state->AddBuiltinCommand("unset", cmUnsetCommand);
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"else",
"An ELSE command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
"the opening IF command.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"elseif",
"An ELSEIF command was found outside of a proper "
"IF ENDIF structure.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"endforeach",
"An ENDFOREACH command was found outside of a proper "
"FOREACH ENDFOREACH structure. Or its arguments did "
"not match the opening FOREACH command.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"endfunction",
"An ENDFUNCTION command was found outside of a proper "
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
"match the opening FUNCTION command.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"endif",
"An ENDIF command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
"the opening IF command.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"endmacro",
"An ENDMACRO command was found outside of a proper "
"MACRO ENDMACRO structure. Or its arguments did not "
"match the opening MACRO command.");
- state->AddUnexpectedCommand(
+ state->AddUnexpectedFlowControlCommand(
"endwhile",
"An ENDWHILE command was found outside of a proper "
"WHILE ENDWHILE structure. Or its arguments did not "
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index cbe1bc8..963118f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -6,6 +6,7 @@
#include <cctype>
#include <cstdio>
#include <sstream>
+#include <utility>
#include <cm/iterator>
#include <cm/memory>
@@ -2400,6 +2401,8 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
cm::optional<cmSourceInfo> info;
cmFortranCompiler fc;
std::vector<std::string> includes;
+ std::string dir_top_bld;
+ std::string module_dir;
{
Json::Value tdio;
Json::Value const& tdi = tdio;
@@ -2414,6 +2417,11 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
}
}
+ dir_top_bld = tdi["dir-top-bld"].asString();
+ if (!dir_top_bld.empty() && !cmHasLiteralSuffix(dir_top_bld, "/")) {
+ dir_top_bld += '/';
+ }
+
Json::Value const& tdi_include_dirs = tdi["include-dirs"];
if (tdi_include_dirs.isArray()) {
for (auto const& tdi_include_dir : tdi_include_dirs) {
@@ -2421,6 +2429,12 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
}
}
+ Json::Value const& tdi_module_dir = tdi["module-dir"];
+ module_dir = tdi_module_dir.asString();
+ if (!module_dir.empty() && !cmHasLiteralSuffix(module_dir, "/")) {
+ module_dir += '/';
+ }
+
Json::Value const& tdi_compiler_id = tdi["compiler-id"];
fc.Id = tdi_compiler_id.asString();
@@ -2448,7 +2462,13 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
for (std::string const& provide : finfo.Provides) {
cmSourceReqInfo src_info;
src_info.LogicalName = provide;
- src_info.CompiledModulePath = provide;
+ if (!module_dir.empty()) {
+ std::string mod = cmStrCat(module_dir, provide);
+ if (!dir_top_bld.empty() && cmHasPrefix(mod, dir_top_bld)) {
+ mod = mod.substr(dir_top_bld.size());
+ }
+ src_info.CompiledModulePath = std::move(mod);
+ }
info->ScanDep.Provides.emplace_back(src_info);
}
for (std::string const& require : finfo.Requires) {
@@ -2458,7 +2478,6 @@ cm::optional<cmSourceInfo> cmcmd_cmake_ninja_depends_fortran(
}
cmSourceReqInfo src_info;
src_info.LogicalName = require;
- src_info.CompiledModulePath = require;
info->ScanDep.Requires.emplace_back(src_info);
}
for (std::string const& include : finfo.Includes) {
@@ -2529,8 +2548,18 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
Json::Value tm = Json::objectValue;
for (cmScanDepInfo const& object : objects) {
for (auto const& p : object.Provides) {
- std::string const mod = cmStrCat(
- module_dir, cmSystemTools::GetFilenameName(p.CompiledModulePath));
+ std::string mod;
+ if (!p.CompiledModulePath.empty()) {
+ // The scanner provided the path to the module file.
+ mod = p.CompiledModulePath;
+ if (!cmSystemTools::FileIsFullPath(mod)) {
+ // Treat relative to work directory (top of build tree).
+ mod = cmSystemTools::CollapseFullPath(mod, dir_top_bld);
+ }
+ } else {
+ // Assume the module file path matches the logical module name.
+ mod = cmStrCat(module_dir, p.LogicalName);
+ }
mod_files[p.LogicalName] = mod;
tm[p.LogicalName] = mod;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 6c52ce0..fa51092 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1359,8 +1359,12 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
return value;
}
-static cmIDEFlagTable const* cmLoadFlagTableJson(
- std::string const& flagJsonPath)
+namespace {
+
+unsigned long long const vsVer16_10_0 = 4503644629696790;
+
+cmIDEFlagTable const* cmLoadFlagTableJson(
+ std::string const& flagJsonPath, cm::optional<unsigned long long> vsver)
{
cmIDEFlagTable* ret = nullptr;
auto savedFlagIterator = loadedFlagJsonFiles.find(flagJsonPath);
@@ -1382,6 +1386,11 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
flagEntry.comment = cmLoadFlagTableString(flag, "comment");
flagEntry.value = cmLoadFlagTableString(flag, "value");
flagEntry.special = cmLoadFlagTableSpecial(flag, "flags");
+ // FIXME: Port this version check to a Json field.
+ if (vsver && *vsver < vsVer16_10_0 &&
+ flagEntry.IDEName == "ExternalWarningLevel") {
+ continue;
+ }
flagTable.push_back(flagEntry);
}
cmIDEFlagTable endFlag{ "", "", "", "", 0 };
@@ -1394,6 +1403,7 @@ static cmIDEFlagTable const* cmLoadFlagTableJson(
}
return ret;
}
+}
cm::optional<std::string> cmGlobalVisualStudio10Generator::FindFlagTable(
cm::string_view toolsetName, cm::string_view table) const
@@ -1456,7 +1466,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
}
}
- if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename)) {
+ cm::optional<unsigned long long> vsver = this->GetVSInstanceVersion();
+ if (cmIDEFlagTable const* ret = cmLoadFlagTableJson(filename, vsver)) {
return ret;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 2596720..48fe465 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -128,6 +128,11 @@ public:
std::string Encoding() override;
const char* GetToolsVersion() const;
+ virtual cm::optional<unsigned long long> GetVSInstanceVersion() const
+ {
+ return {};
+ }
+
bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
bool FindMakeProgram(cmMakefile* mf) override;
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index c11ab1b..50dc30b 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -391,10 +391,15 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
}
-bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion(
- unsigned long long& vsInstanceVersion) const
+cm::optional<unsigned long long>
+cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion() const
{
- return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion);
+ cm::optional<unsigned long long> result;
+ unsigned long long vsInstanceVersion;
+ if (vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion)) {
+ result = vsInstanceVersion;
+ }
+ return result;
}
bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
@@ -407,9 +412,9 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
return false;
}
unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212;
- unsigned long long vsInstanceVersion;
- return (this->GetVSInstanceVersion(vsInstanceVersion) &&
- vsInstanceVersion > vsInstanceVersion16_7_P2);
+ cm::optional<unsigned long long> vsInstanceVersion =
+ this->GetVSInstanceVersion();
+ return (vsInstanceVersion && *vsInstanceVersion > vsInstanceVersion16_7_P2);
}
const char*
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h
index cee129e..105e495 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.h
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.h
@@ -28,7 +28,7 @@ public:
bool GetVSInstance(std::string& dir) const;
- bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const;
+ cm::optional<unsigned long long> GetVSInstanceVersion() const override;
AuxToolset FindAuxToolset(std::string& version,
std::string& props) const override;
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
index 6620221..6fcbce5 100644
--- a/Source/cmScanDepFormat.cxx
+++ b/Source/cmScanDepFormat.cxx
@@ -3,7 +3,6 @@
#include "cmScanDepFormat.h"
-#include <cassert>
#include <cctype>
#include <cstdio>
#include <utility>
@@ -163,9 +162,6 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
provide["compiled-module-path"];
PARSE_FILENAME(compiled_module_path,
provide_info.CompiledModulePath);
- } else {
- provide_info.CompiledModulePath =
- cmStrCat(provide_info.LogicalName, ".mod");
}
if (provide.isMember("unique-on-source-path")) {
@@ -300,9 +296,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
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 {
+ if (!provide.CompiledModulePath.empty()) {
provide_obj["compiled-module-path"] =
EncodeFilename(provide.CompiledModulePath);
}
@@ -322,9 +316,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
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 {
+ if (!require.CompiledModulePath.empty()) {
require_obj["compiled-module-path"] =
EncodeFilename(require.CompiledModulePath);
}
@@ -339,7 +331,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
const char* lookup_method = nullptr;
switch (require.Method) {
case LookupMethod::ByName:
- lookup_method = "by-name";
+ // No explicit value needed for the default.
break;
case LookupMethod::IncludeAngle:
lookup_method = "include-angle";
@@ -348,8 +340,9 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
lookup_method = "include-quote";
break;
}
- assert(lookup_method);
- require_obj["lookup-method"] = lookup_method;
+ if (lookup_method) {
+ require_obj["lookup-method"] = lookup_method;
+ }
reqs.append(require_obj);
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 0b8a64b..ce6eb31 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -481,7 +481,7 @@ void cmState::AddDisallowedCommand(std::string const& name,
void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
{
- this->AddFlowControlCommand(
+ this->AddBuiltinCommand(
name,
[name, error](std::vector<cmListFileArgument> const&,
cmExecutionStatus& status) -> bool {
@@ -496,6 +496,13 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
});
}
+void cmState::AddUnexpectedFlowControlCommand(std::string const& name,
+ const char* error)
+{
+ this->FlowControlCommands.insert(name);
+ this->AddUnexpectedCommand(name, error);
+}
+
bool cmState::AddScriptedCommand(std::string const& name, BT<Command> command,
cmMakefile& mf)
{
diff --git a/Source/cmState.h b/Source/cmState.h
index 4e41156..9951b9a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -166,6 +166,8 @@ public:
void AddDisallowedCommand(std::string const& name, BuiltinCommand command,
cmPolicies::PolicyID policy, const char* message);
void AddUnexpectedCommand(std::string const& name, const char* error);
+ void AddUnexpectedFlowControlCommand(std::string const& name,
+ const char* error);
bool AddScriptedCommand(std::string const& name, BT<Command> command,
cmMakefile& mf);
void RemoveBuiltinCommand(std::string const& name);
diff --git a/Tests/RunCMake/Syntax/OverrideProject-result.txt b/Tests/RunCMake/Syntax/OverrideProject-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/OverrideProject-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/OverrideProject-stderr.txt b/Tests/RunCMake/Syntax/OverrideProject-stderr.txt
new file mode 100644
index 0000000..862d5c8
--- /dev/null
+++ b/Tests/RunCMake/Syntax/OverrideProject-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/Tests/RunCMake/Syntax/Override\.cmake:[0-9]+ \(message\):
+ This shouldn't happen$
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index 4d24657..f0c287c 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -150,3 +150,4 @@ run_override(If)
run_override(Macro)
run_override(Return)
run_override(While)
+run_override(Project)