summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/3.11.rst2
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in2
-rw-r--r--Modules/Compiler/Clang-CXX.cmake28
-rw-r--r--Modules/Compiler/IAR-ASM.cmake2
-rw-r--r--Modules/FindCUDA.cmake1
-rw-r--r--Modules/FindCUDAToolkit.cmake3
-rw-r--r--Modules/FindMatlab.cmake1
-rw-r--r--Modules/FindPython.cmake2
-rw-r--r--Modules/FindPython/Support.cmake2
-rw-r--r--Modules/UseJava.cmake2
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCxxModuleMapper.cxx8
-rw-r--r--Source/cmCxxModuleMapper.h2
-rw-r--r--Source/cmDyndepCollation.cxx49
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx53
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
-rw-r--r--Source/cmLocalNinjaGenerator.cxx27
-rw-r--r--Source/cmNinjaTargetGenerator.cxx4
-rw-r--r--Tests/CudaOnly/CUBIN/CMakeLists.txt10
-rw-r--r--Tests/CudaOnly/CUBIN/main.cu2
-rw-r--r--Tests/CudaOnly/CUBIN/main_no_native_archs.cu4
-rw-r--r--Tests/CudaOnly/Fatbin/main.cu2
-rw-r--r--Tests/FindPython/Python3SABIModule/CMakeLists.txt8
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-check.cmake3
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-stdout.txt1
-rw-r--r--Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl.cmake3
-rw-r--r--Tests/RunCMake/showIncludes.c14
30 files changed, 154 insertions, 89 deletions
diff --git a/Help/release/3.11.rst b/Help/release/3.11.rst
index 957dd4f..6e1520a 100644
--- a/Help/release/3.11.rst
+++ b/Help/release/3.11.rst
@@ -174,7 +174,7 @@ Modules
to removal of the ``javah`` tool by `JEP 313`_.
.. _`FLAME`: https://github.com/flame
-.. _`JEP 313`: https://openjdk.java.net/jeps/313
+.. _`JEP 313`: https://openjdk.org/jeps/313
Autogen
-------
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 0878dff..67044fb 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -1147,7 +1147,7 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
ENCODING AUTO # cl prints in console output code page
)
string(REPLACE "\n" "\n " msg " ${out}")
- if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)[A-Za-z]:\\\\")
+ if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n][^:\n]+:[^:\n]*[^: \n][^: \n]:?[ \t]+)([A-Za-z]:\\\\|\\./)")
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE)
string(APPEND msg "\nFound prefix \"${CMAKE_MATCH_2}\"")
else()
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index b8b409a..fc81d0e 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -26,7 +26,7 @@ set(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@)
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
-set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95@CMAKE_Fortran_VENDOR_SOURCE_FILE_EXTENSIONS@)
+set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95;f03;F03;f08;F08@CMAKE_Fortran_VENDOR_SOURCE_FILE_EXTENSIONS@)
set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_Fortran_LINKER_PREFERENCE 20)
if(UNIX)
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 33154fd..a74e90b 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -30,16 +30,18 @@ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")
endif()
endif()
-if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
- string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
- "${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}"
- " -format=p1689"
- " --"
- " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>"
- " -x c++ <SOURCE> -c -o <OBJECT>"
- " -MT <DYNDEP_FILE>"
- " -MD -MF <DEP_FILE>"
- " > <DYNDEP_FILE>")
- set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang")
- set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
-endif ()
+if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
+ if("x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
+ "\"${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}\""
+ " -format=p1689"
+ " --"
+ " <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>"
+ " -x c++ <SOURCE> -c -o <OBJECT>"
+ " -MT <DYNDEP_FILE>"
+ " -MD -MF <DEP_FILE>"
+ " > <DYNDEP_FILE>")
+ set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang")
+ set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
+ endif()
+endif()
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake
index 98f58e7..4c0025c 100644
--- a/Modules/Compiler/IAR-ASM.cmake
+++ b/Modules/Compiler/IAR-ASM.cmake
@@ -5,7 +5,7 @@ include(Compiler/IAR)
# Architecture specific
if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
__compiler_iar_ilink(ASM)
- __assembler_iar_deps("-y" 9)
+ __assembler_iar_deps("-y" 9.30)
set(_CMAKE_IAR_SILENCER_FLAG " -S")
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index f65bb73..220b9ab 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1074,6 +1074,7 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME)
if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX"))
#On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDA_rt_LIBRARY rt)
+ mark_as_advanced(CUDA_rt_LIBRARY)
if (NOT CUDA_rt_LIBRARY)
message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.")
endif()
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 713f3b8..67bf424 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -623,8 +623,8 @@ else()
endif()
unset(_CUDA_NVCC_OUT)
- mark_as_advanced(CUDAToolkit_BIN_DIR)
set(CUDAToolkit_BIN_DIR "${CUDAToolkit_BIN_DIR}" CACHE PATH "" FORCE)
+ mark_as_advanced(CUDAToolkit_BIN_DIR)
endif()
if(CUDAToolkit_SENTINEL_FILE)
@@ -1108,6 +1108,7 @@ if(CUDAToolkit_FOUND)
"${CUDAToolkit_INCLUDE_DIR}/../extras/CUPTI/include"
"${CUDAToolkit_INCLUDE_DIR}"
NO_DEFAULT_PATH)
+ mark_as_advanced(CUDAToolkit_CUPTI_INCLUDE_DIR)
if(CUDAToolkit_CUPTI_INCLUDE_DIR)
_CUDAToolkit_find_and_add_import_lib(cupti
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index cbf0445..e111b79 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -302,6 +302,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS)
endif()
set(MATLAB_VERSIONS_MAPPING
+ "R2023a=9.14"
"R2022b=9.13"
"R2022a=9.12"
"R2021b=9.11"
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index fd2eeaa..31ef1c7 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -542,7 +542,7 @@ If the library type is not specified, ``MODULE`` is assumed.
was introduced. Specifying only major version ``3`` is equivalent to ``3.2``.
When option ``WITH_SOABI`` is also specified, the module suffix will include
- the ``Python3_SOSABI`` value, if any.
+ the ``Python_SOSABI`` value, if any.
#]=======================================================================]
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index f1be0f4..517ac21 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -579,7 +579,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endif()
endif()
elseif (NAME STREQUAL "SOSABI")
- execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
+ execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib.machinery\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _values
ERROR_QUIET
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 54a8cf7..99fd617 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -294,7 +294,7 @@ Header Generation
.. deprecated:: 3.11
This command will no longer be supported starting with version 10 of the JDK
- due to the `suppression of javah tool <https://openjdk.java.net/jeps/313>`_.
+ due to the `suppression of javah tool <https://openjdk.org/jeps/313>`_.
The :ref:`add_jar(GENERATE_NATIVE_HEADERS) <add_jar>` command should be
used instead.
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 1c5ecd5..4db725c 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -49,7 +49,7 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
if(NOT CVF_ARCH_INDEPENDENT)
set(CVF_ARCH_INDEPENDENT_CHECK "
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
-if(CMAKE_SIZEOF_VOID_P STREQUAL \"\" OR \"${CMAKE_SIZEOF_VOID_P}\" STREQUAL \"\")
+if(\"\${CMAKE_SIZEOF_VOID_P}\" STREQUAL \"\" OR \"${CMAKE_SIZEOF_VOID_P}\" STREQUAL \"\")
return()
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index cf6043a..3e24cb6 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 26)
-set(CMake_VERSION_PATCH 20230316)
+set(CMake_VERSION_PATCH 20230321)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx
index 7952dfc..59bf4c7 100644
--- a/Source/cmCxxModuleMapper.cxx
+++ b/Source/cmCxxModuleMapper.cxx
@@ -21,7 +21,7 @@ cm::optional<std::string> CxxModuleLocations::BmiGeneratorPathForModule(
std::string const& logical_name) const
{
if (auto l = this->BmiLocationForModule(logical_name)) {
- return this->PathForGenerator(*l);
+ return this->PathForGenerator(std::move(*l));
}
return {};
}
@@ -239,8 +239,7 @@ std::set<std::string> CxxModuleUsageSeed(
for (auto const& p : object.Provides) {
if (auto bmi_loc = loc.BmiGeneratorPathForModule(p.LogicalName)) {
// XXX(cxx-modules): How to support header units?
- usages.AddReference(p.LogicalName, loc.PathForGenerator(*bmi_loc),
- LookupMethod::ByName);
+ usages.AddReference(p.LogicalName, *bmi_loc, LookupMethod::ByName);
}
}
@@ -268,8 +267,7 @@ std::set<std::string> CxxModuleUsageSeed(
}
if (bmi_loc) {
- usages.AddReference(r.LogicalName, loc.PathForGenerator(*bmi_loc),
- r.Method);
+ usages.AddReference(r.LogicalName, *bmi_loc, r.Method);
}
}
}
diff --git a/Source/cmCxxModuleMapper.h b/Source/cmCxxModuleMapper.h
index 9271978..0f453b0 100644
--- a/Source/cmCxxModuleMapper.h
+++ b/Source/cmCxxModuleMapper.h
@@ -30,7 +30,7 @@ struct CxxModuleLocations
std::string RootDirectory;
// A function to convert a full path to a path for the generator.
- std::function<std::string(std::string const&)> PathForGenerator;
+ std::function<std::string(std::string)> PathForGenerator;
// Lookup the BMI location of a logical module name.
std::function<cm::optional<std::string>(std::string const&)>
diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx
index 2827659..53a262b 100644
--- a/Source/cmDyndepCollation.cxx
+++ b/Source/cmDyndepCollation.cxx
@@ -441,20 +441,16 @@ bool cmDyndepCollation::WriteDyndepMetadata(
auto fileset_info_itr = export_info.ObjectToFileSet.find(output_path);
bool const has_provides = !object.Provides.empty();
if (fileset_info_itr == export_info.ObjectToFileSet.end()) {
- // If it provides anything, it should have a `CXX_MODULES` or
- // `CXX_MODULE_INTERNAL_PARTITIONS` type and be present.
+ // If it provides anything, it should have type `CXX_MODULES`
+ // and be present.
if (has_provides) {
// Take the first module provided to provide context.
auto const& provides = object.Provides[0];
- char const* ok_types = "`CXX_MODULES`";
- if (provides.LogicalName.find(':') != std::string::npos) {
- ok_types = "`CXX_MODULES` (or `CXX_MODULE_INTERNAL_PARTITIONS` if "
- "it is not `export`ed)";
- }
- cmSystemTools::Error(cmStrCat(
- "Output ", object.PrimaryOutput, " provides the `",
- provides.LogicalName,
- "` module but it is not found in a `FILE_SET` of type ", ok_types));
+ cmSystemTools::Error(
+ cmStrCat("Output ", object.PrimaryOutput, " provides the `",
+ provides.LogicalName,
+ "` module but it is not found in a `FILE_SET` of type "
+ "`CXX_MODULES`"));
result = false;
}
@@ -474,38 +470,15 @@ bool cmDyndepCollation::WriteDyndepMetadata(
result = false;
continue;
}
- } else if (file_set.Type == "CXX_MODULE_INTERNAL_PARTITIONS"_s) {
- if (!has_provides) {
- cmSystemTools::Error(
- cmStrCat("Source ", file_set.SourcePath,
- " is of type `CXX_MODULE_INTERNAL_PARTITIONS` but does not "
- "provide a module"));
- result = false;
- continue;
- }
- auto const& provides = object.Provides[0];
- if (provides.LogicalName.find(':') == std::string::npos) {
- cmSystemTools::Error(
- cmStrCat("Source ", file_set.SourcePath,
- " is of type `CXX_MODULE_INTERNAL_PARTITIONS` but does not "
- "provide a module partition"));
- result = false;
- continue;
- }
} else if (file_set.Type == "CXX_MODULE_HEADERS"_s) {
// TODO.
} else {
if (has_provides) {
auto const& provides = object.Provides[0];
- char const* ok_types = "`CXX_MODULES`";
- if (provides.LogicalName.find(':') != std::string::npos) {
- ok_types = "`CXX_MODULES` (or `CXX_MODULE_INTERNAL_PARTITIONS` if "
- "it is not `export`ed)";
- }
- cmSystemTools::Error(
- cmStrCat("Source ", file_set.SourcePath, " provides the `",
- provides.LogicalName, "` C++ module but is of type `",
- file_set.Type, "` module but must be of type ", ok_types));
+ cmSystemTools::Error(cmStrCat(
+ "Source ", file_set.SourcePath, " provides the `",
+ provides.LogicalName, "` C++ module but is of type `", file_set.Type,
+ "` module but must be of type `CXX_MODULES`"));
result = false;
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 650d0aa..37856d9 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -63,6 +63,19 @@ std::string const cmGlobalNinjaGenerator::SHELL_NOOP = "cd .";
std::string const cmGlobalNinjaGenerator::SHELL_NOOP = ":";
#endif
+namespace {
+#ifdef _WIN32
+bool DetectGCCOnWindows(cm::string_view compilerId, cm::string_view simulateId,
+ cm::string_view compilerFrontendVariant)
+{
+ return ((compilerId == "Clang"_s && compilerFrontendVariant == "GNU"_s) ||
+ (simulateId != "MSVC"_s &&
+ (compilerId == "GNU"_s || compilerId == "QCC"_s ||
+ cmHasLiteralSuffix(compilerId, "Clang"))));
+}
+#endif
+}
+
bool operator==(
const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& lhs,
const cmGlobalNinjaGenerator::ByConfig::TargetDependsClosureKey& rhs)
@@ -936,12 +949,8 @@ void cmGlobalNinjaGenerator::EnableLanguage(
mf->GetSafeDefinition(cmStrCat("CMAKE_", l, "_SIMULATE_ID"));
std::string const& compilerFrontendVariant = mf->GetSafeDefinition(
cmStrCat("CMAKE_", l, "_COMPILER_FRONTEND_VARIANT"));
- if ((compilerId == "Clang" && compilerFrontendVariant == "GNU") ||
- (simulateId != "MSVC" &&
- (compilerId == "GNU" || compilerId == "QCC" ||
- cmHasLiteralSuffix(compilerId, "Clang")))) {
- this->UsingGCCOnWindows = true;
- }
+ this->SetUsingGCCOnWindows(
+ DetectGCCOnWindows(compilerId, simulateId, compilerFrontendVariant));
#endif
}
}
@@ -2629,8 +2638,14 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile(
{
CxxModuleLocations locs;
locs.RootDirectory = ".";
- locs.PathForGenerator = [this](std::string const& path) -> std::string {
- return this->ConvertToNinjaPath(path);
+ locs.PathForGenerator = [this](std::string path) -> std::string {
+ path = this->ConvertToNinjaPath(path);
+# ifdef _WIN32
+ if (this->IsGCCOnWindows()) {
+ std::replace(path.begin(), path.end(), '\\', '/');
+ }
+# endif
+ return path;
};
locs.BmiLocationForModule =
[&mod_files](std::string const& logical) -> cm::optional<std::string> {
@@ -2811,6 +2826,10 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
linked_target_dirs.push_back(tdi_linked_target_dir.asString());
}
}
+ std::string const compilerId = tdi["compiler-id"].asString();
+ std::string const simulateId = tdi["compiler-simulate-id"].asString();
+ std::string const compilerFrontendVariant =
+ tdi["compiler-frontend-variant"].asString();
auto export_info = cmDyndepCollation::ParseExportInfo(tdi);
@@ -2818,14 +2837,20 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cm.SetHomeDirectory(dir_top_src);
cm.SetHomeOutputDirectory(dir_top_bld);
auto ggd = cm.CreateGlobalGenerator("Ninja");
- if (!ggd ||
- !cm::static_reference_cast<cmGlobalNinjaGenerator>(ggd).WriteDyndepFile(
- dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld, arg_dd, arg_ddis,
- module_dir, linked_target_dirs, arg_lang, arg_modmapfmt,
- *export_info)) {
+ if (!ggd) {
return 1;
}
- return 0;
+ cmGlobalNinjaGenerator& gg =
+ cm::static_reference_cast<cmGlobalNinjaGenerator>(ggd);
+# ifdef _WIN32
+ gg.SetUsingGCCOnWindows(
+ DetectGCCOnWindows(compilerId, simulateId, compilerFrontendVariant));
+# endif
+ return gg.WriteDyndepFile(dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld,
+ arg_dd, arg_ddis, module_dir, linked_target_dirs,
+ arg_lang, arg_modmapfmt, *export_info)
+ ? 0
+ : 1;
}
#endif
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index c08bb46..12c6698 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -169,6 +169,7 @@ public:
const std::string& comment = "");
bool IsGCCOnWindows() const { return this->UsingGCCOnWindows; }
+ void SetUsingGCCOnWindows(bool b) { this->UsingGCCOnWindows = b; }
cmGlobalNinjaGenerator(cmake* cm);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index f8027c0..305dab3 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -456,6 +456,22 @@ std::string cmLocalNinjaGenerator::WriteCommandScript(
return scriptPath;
}
+#ifdef _WIN32
+namespace {
+bool RuleNeedsCMD(std::string const& cmd)
+{
+ std::vector<std::string> args;
+ cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args);
+ auto it = std::find_if(args.cbegin(), args.cend(),
+ [](std::string const& arg) -> bool {
+ // FIXME: Detect more windows shell operators.
+ return cmHasLiteralPrefix(arg, ">");
+ });
+ return it != args.cend();
+}
+}
+#endif
+
std::string cmLocalNinjaGenerator::BuildCommandLine(
std::vector<std::string> const& cmdLines, std::string const& outputConfig,
std::string const& commandConfig, std::string const& customStep,
@@ -498,12 +514,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
}
std::ostringstream cmd;
- for (auto li = cmdLines.begin(); li != cmdLines.end(); ++li)
#ifdef _WIN32
- {
+ bool const needCMD =
+ cmdLines.size() > 1 || (customStep.empty() && RuleNeedsCMD(cmdLines[0]));
+ for (auto li = cmdLines.begin(); li != cmdLines.end(); ++li) {
if (li != cmdLines.begin()) {
cmd << " && ";
- } else if (cmdLines.size() > 1) {
+ } else if (needCMD) {
cmd << "cmd.exe /C \"";
}
// Put current cmdLine in brackets if it contains "||" because it has
@@ -514,11 +531,11 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
cmd << *li;
}
}
- if (cmdLines.size() > 1) {
+ if (needCMD) {
cmd << "\"";
}
#else
- {
+ for (auto li = cmdLines.begin(); li != cmdLines.end(); ++li) {
if (li != cmdLines.begin()) {
cmd << " && ";
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8719364..4c0f935 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1651,6 +1651,10 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang,
tdi["language"] = lang;
tdi["compiler-id"] = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
+ tdi["compiler-simulate-id"] = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_SIMULATE_ID"));
+ tdi["compiler-frontend-variant"] = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILER_FRONTEND_VARIANT"));
std::string mod_dir;
if (lang == "Fortran") {
diff --git a/Tests/CudaOnly/CUBIN/CMakeLists.txt b/Tests/CudaOnly/CUBIN/CMakeLists.txt
index 464714b..81787e4 100644
--- a/Tests/CudaOnly/CUBIN/CMakeLists.txt
+++ b/Tests/CudaOnly/CUBIN/CMakeLists.txt
@@ -1,9 +1,17 @@
cmake_minimum_required(VERSION 3.18)
+unset(ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}) # CUBIN needs true native arch
project(CudaCUBIN LANGUAGES CUDA)
-
set(CMAKE_CUDA_ARCHITECTURES all-major)
+# CUBIN needs the true native arch to be supported by the CUDA toolkit.
+set(unavailable_native_archs "${CMAKE_CUDA_ARCHITECTURES_NATIVE}")
+list(REMOVE_ITEM unavailable_native_archs ${CMAKE_CUDA_ARCHITECTURES_ALL})
+if(unavailable_native_archs)
+ add_executable(CudaOnlyCUBIN main_no_native_archs.cu)
+ return()
+endif()
+
add_library(CudaCUBIN OBJECT kernelA.cu kernelB.cu kernelC.cu)
set_property(TARGET CudaCUBIN PROPERTY CUDA_CUBIN_COMPILATION ON)
set_property(TARGET CudaCUBIN PROPERTY CUDA_ARCHITECTURES native)
diff --git a/Tests/CudaOnly/CUBIN/main.cu b/Tests/CudaOnly/CUBIN/main.cu
index da5249c..581970a 100644
--- a/Tests/CudaOnly/CUBIN/main.cu
+++ b/Tests/CudaOnly/CUBIN/main.cu
@@ -53,4 +53,6 @@ int main()
return 1;
}
}
+
+ return 0;
}
diff --git a/Tests/CudaOnly/CUBIN/main_no_native_archs.cu b/Tests/CudaOnly/CUBIN/main_no_native_archs.cu
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/CudaOnly/CUBIN/main_no_native_archs.cu
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/Fatbin/main.cu b/Tests/CudaOnly/Fatbin/main.cu
index 903feee..89af0e3 100644
--- a/Tests/CudaOnly/Fatbin/main.cu
+++ b/Tests/CudaOnly/Fatbin/main.cu
@@ -53,4 +53,6 @@ int main()
return 1;
}
}
+
+ return 0;
}
diff --git a/Tests/FindPython/Python3SABIModule/CMakeLists.txt b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
index 1a909ec..e045b69 100644
--- a/Tests/FindPython/Python3SABIModule/CMakeLists.txt
+++ b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.7)
project(TestPython3SABIModule LANGUAGES C)
@@ -35,12 +35,16 @@ if(NOT TARGET Python3::SABIModule)
message(SEND_ERROR "Python3::SABIModule not found")
endif()
+if (Python3_VERSION VERSION_GREATER_EQUAL "3.2" AND NOT Python3_SOSABI)
+ message(FATAL_ERROR "Python3_SOSABI unexpectedly not defined")
+endif()
+
Python3_add_library (spam3 MODULE USE_SABI 3 WITH_SOABI ../spam.c)
target_compile_definitions (spam3 PRIVATE PYTHON3)
if (Python3_SOSABI)
get_property (suffix TARGET spam3 PROPERTY SUFFIX)
- if (NOT suffix MATCHES "^.${Python3_SOSABI}")
+ if (NOT suffix MATCHES "^\\.${Python3_SOSABI}")
message(FATAL_ERROR "Module suffix do not include Python3_SOSABI")
endif()
endif()
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 91c48c6..619e94a 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -46,6 +46,7 @@ if(WIN32)
if(RunCMake_MAKE_PROGRAM)
set(maybe_MAKE_PROGRAM "-DRunCMake_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
endif()
+ run_cmake_script(ShowIncludes-437-ClangCl -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-437-English -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-437-French -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
run_cmake_script(ShowIncludes-437-German -DshowIncludes=${showIncludes} ${maybe_MAKE_PROGRAM})
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-check.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-check.cmake
new file mode 100644
index 0000000..6136463
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-check.cmake
@@ -0,0 +1,3 @@
+# 'clang-cl /showIncludes' prefix.
+set(expect "Note: including file: ")
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes-check.cmake)
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-stdout.txt b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-stdout.txt
new file mode 100644
index 0000000..bda7eab
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl-stdout.txt
@@ -0,0 +1 @@
+-- showIncludes='Note: including file: '
diff --git a/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl.cmake b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl.cmake
new file mode 100644
index 0000000..7eca3d3
--- /dev/null
+++ b/Tests/RunCMake/Ninja/ShowIncludes-437-ClangCl.cmake
@@ -0,0 +1,3 @@
+set(CODEPAGE 437)
+set(VSLANG "clang-cl") # Special case for test, not a real VS value.
+include(${CMAKE_CURRENT_LIST_DIR}/ShowIncludes.cmake)
diff --git a/Tests/RunCMake/showIncludes.c b/Tests/RunCMake/showIncludes.c
index 4ea2bcc..5afe04a 100644
--- a/Tests/RunCMake/showIncludes.c
+++ b/Tests/RunCMake/showIncludes.c
@@ -28,6 +28,15 @@ int main()
printf("OEM code page: %u\n", GetOEMCP());
printf("VSLANG: %s\n", vslang);
+ // clang-cl (special case for test, not a real VS value).
+ if (strcmp(vslang, "clang-cl") == 0) {
+ if (cp == 437 || cp == 65001) {
+ printf("Note: including file: ./foo.h\n");
+ return 0;
+ }
+ }
+
+ // German.
if (strcmp(vslang, "1031") == 0) {
if (cp == 437 || cp == 65001) {
printf("Hinweis: Einlesen der Datei: C:\\foo.h\n");
@@ -35,6 +44,7 @@ int main()
}
}
+ // English.
if (strcmp(vslang, "1033") == 0) {
if (cp == 437 || cp == 65001) {
printf("Note: including file: C:\\foo.h\n");
@@ -42,6 +52,7 @@ int main()
}
}
+ // French.
if (strcmp(vslang, "1036") == 0) {
if (cp == 437 || cp == 863) {
printf("Remarque\xff: inclusion du fichier\xff: C:\\foo.h\n");
@@ -53,6 +64,7 @@ int main()
}
}
+ // Italian.
if (strcmp(vslang, "1040") == 0) {
if (cp == 437 || cp == 65001) {
printf("Nota: file incluso C:\\foo.h\n");
@@ -60,6 +72,7 @@ int main()
}
}
+ // Japanese.
if (strcmp(vslang, "1041") == 0) {
if (cp == 932) {
printf("\x83\x81\x83\x82: "
@@ -75,6 +88,7 @@ int main()
}
}
+ // Chinese.
if (strcmp(vslang, "2052") == 0) {
if (cp == 54936 || cp == 936) {
printf("\xd7\xa2\xd2\xe2: "