summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt57
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackNuGetGenerator.cxx10
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/Checks/Curses/CMakeLists.txt2
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx68
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h6
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx3
-rw-r--r--Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx9
-rw-r--r--Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx17
-rw-r--r--Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx9
-rw-r--r--Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx9
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx31
-rw-r--r--Source/cmCxxModuleMapper.cxx105
-rw-r--r--Source/cmDebuggerVariablesHelper.cxx14
-rw-r--r--Source/cmExecuteProcessCommand.cxx3
-rw-r--r--Source/cmExperimental.cxx2
-rw-r--r--Source/cmExportBuildFileGenerator.cxx3
-rw-r--r--Source/cmExportFileGenerator.cxx6
-rw-r--r--Source/cmExportInstallFileGenerator.cxx26
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx4
-rw-r--r--Source/cmFileCommand.cxx15
-rw-r--r--Source/cmFileLock.cxx12
-rw-r--r--Source/cmFileLock.h6
-rw-r--r--Source/cmFileLockResult.cxx4
-rw-r--r--Source/cmFileLockResult.h8
-rw-r--r--Source/cmFileLockWin32.cxx2
-rw-r--r--Source/cmFindLibraryCommand.cxx10
-rw-r--r--Source/cmFunctionCommand.cxx5
-rw-r--r--Source/cmGeneratedFileStream.cxx6
-rw-r--r--Source/cmGeneratedFileStream.h10
-rw-r--r--Source/cmGeneratorExpressionNode.cxx14
-rw-r--r--Source/cmGeneratorTarget.cxx22
-rw-r--r--Source/cmGeneratorTarget.h4
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.h7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx12
-rw-r--r--Source/cmGlobalNinjaGenerator.h6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx139
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h9
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx10
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h7
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmLDConfigLDConfigTool.cxx9
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx3
-rw-r--r--Source/cmList.cxx11
-rw-r--r--Source/cmList.h40
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmLocalXCodeGenerator.cxx6
-rw-r--r--Source/cmMacroCommand.cxx6
-rw-r--r--Source/cmMakefile.cxx13
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmParseArgumentsCommand.cxx17
-rw-r--r--Source/cmSeparateArgumentsCommand.cxx3
-rw-r--r--Source/cmSetCommand.cxx4
-rw-r--r--Source/cmSourceFile.cxx7
-rw-r--r--Source/cmSourceGroupCommand.cxx23
-rw-r--r--Source/cmState.cxx8
-rw-r--r--Source/cmStateDirectory.cxx24
-rw-r--r--Source/cmTarget.cxx12
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx3
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx3
-rw-r--r--Source/cmTargetLinkDirectoriesCommand.cxx3
-rw-r--r--Source/cmTargetLinkOptionsCommand.cxx3
-rw-r--r--Source/cmTargetPrecompileHeadersCommand.cxx3
-rw-r--r--Source/cmTargetSourcesCommand.cxx2
-rw-r--r--Source/cmUVProcessChain.cxx247
-rw-r--r--Source/cmUVProcessChain.h10
-rw-r--r--Source/cmUVStream.h140
-rw-r--r--Source/cmUVStreambuf.h3
-rw-r--r--Source/cmUuid.cxx10
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx12
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx1
-rw-r--r--Source/cm_codecvt.cxx12
-rw-r--r--Source/cm_codecvt.hxx13
-rw-r--r--Source/cm_codecvt_Encoding.hxx12
-rw-r--r--Source/cmake.cxx17
-rw-r--r--Source/cmcmd.cxx23
87 files changed, 857 insertions, 619 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index b01e1e7..708aec7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -438,6 +438,7 @@ add_library(
cmUVHandlePtr.h
cmUVProcessChain.cxx
cmUVProcessChain.h
+ cmUVStream.h
cmUVStreambuf.h
cmUVSignalHackRAII.h
cmVariableWatch.cxx
@@ -928,6 +929,44 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
endif()
+if(CMake_BUILD_PCH)
+ target_precompile_headers(CMakeLib PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:<string$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:<iostream$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:<sstream$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:<iomanip$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:<cm/memory$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:<cm3p/cppdap/protocol.h$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmMakefile.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmGlobalGenerator.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmLocalGenerator.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmGeneratorTarget.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmGeneratorExpression.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmArgumentParser.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmake.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmCMakePath.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmDebuggerPipeConnection.h>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmCurl.h>")
+
+ set_source_files_properties(
+ "LexerParser/cmFortranLexer.cxx"
+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+
+ if(WIN32)
+ target_precompile_headers(CMakeLib PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:<cm3p/uv.h$<ANGLE-R>>"
+ "$<$<COMPILE_LANGUAGE:CXX>:cmVSSetupHelper.h>")
+ set_source_files_properties("LexerParser/cmFortranParser.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+ else()
+ set_source_files_properties(
+ "LexerParser/cmCommandArgumentLexer.cxx"
+ "LexerParser/cmGccDepfileLexer.cxx"
+ "LexerParser/cmExprLexer.cxx"
+ "LexerParser/cmDependsJavaLexer.cxx"
+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+ endif()
+endif()
+
# Temporary variable for tools targets
set(_tools)
@@ -1040,6 +1079,24 @@ target_include_directories(
)
target_link_libraries(CTestLib PUBLIC CMakeLib)
+if(CMake_BUILD_PCH)
+ target_precompile_headers(CTestLib PRIVATE
+ "cmDuration.h"
+ "cmMakefile.h"
+ "cmSystemTools.h"
+ "cmGlobalGenerator.h"
+ "cmake.h"
+ "CTest/cmCTestGenericHandler.h"
+ "<sstream>"
+ "<cm3p/uv.h>")
+
+ if(WIN32)
+ target_precompile_headers(CTestLib PRIVATE "cmCurl.h" "CTest/cmCTestMultiProcessHandler.h")
+ else()
+ set_source_files_properties("LexerParser/cmCTestResourceGroupsLexer.cxx" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
+ endif()
+endif()
+
#
# Build CPackLib
#
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1d028f6..6c76648 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,8 +1,8 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 27)
-set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 4)
+set(CMake_VERSION_PATCH 20230714)
+#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index afd85cd..11d90c0 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1119,8 +1119,8 @@ int cmCPackGenerator::DoPackage()
// Run post-build actions
cmValue postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS");
if (postBuildScripts) {
- this->MakefileMap->AddDefinition("CPACK_PACKAGE_FILES",
- cmJoin(this->packageFileNames, ";"));
+ this->MakefileMap->AddDefinition(
+ "CPACK_PACKAGE_FILES", cmList::to_string(this->packageFileNames));
const cmList scripts{ postBuildScripts };
for (const auto& script : scripts) {
diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx
index 5de8179..aa99fb6 100644
--- a/Source/CPack/cmCPackNuGetGenerator.cxx
+++ b/Source/CPack/cmCPackNuGetGenerator.cxx
@@ -12,7 +12,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
-#include "cmStringAlgorithms.h"
+#include "cmList.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -82,10 +82,10 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
std::back_inserter(components),
[](cmCPackComponent const* comp) { return comp->Name; });
this->SetOption("CPACK_NUGET_" + compGUp + "_GROUP_COMPONENTS",
- cmJoin(components, ";"));
+ cmList::to_string(components));
}
if (!groups.empty()) {
- this->SetOption("CPACK_NUGET_GROUPS", cmJoin(groups, ";"));
+ this->SetOption("CPACK_NUGET_GROUPS", cmList::to_string(groups));
}
// Handle Orphan components (components not belonging to any groups)
@@ -103,7 +103,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
}
}
if (!components.empty()) {
- this->SetOption("CPACK_NUGET_COMPONENTS", cmJoin(components, ";"));
+ this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components));
}
} else {
@@ -114,7 +114,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
[](std::pair<std::string, cmCPackComponent> const& comp) {
return comp.first;
});
- this->SetOption("CPACK_NUGET_COMPONENTS", cmJoin(components, ";"));
+ this->SetOption("CPACK_NUGET_COMPONENTS", cmList::to_string(components));
}
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 90716e6..00c8fa2 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -363,11 +363,11 @@ int main(int argc, char const* const* argv)
}
if (!expandedPreset->Generators.empty() && generator.empty()) {
- generator = cmJoin(expandedPreset->Generators, ";");
+ generator = cmList::to_string(expandedPreset->Generators);
}
if (!expandedPreset->Configurations.empty() && cpackBuildConfig.empty()) {
- cpackBuildConfig = cmJoin(expandedPreset->Configurations, ";");
+ cpackBuildConfig = cmList::to_string(expandedPreset->Configurations);
}
definitions.insert(expandedPreset->Variables.begin(),
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index 0fee7ac..bc6b906 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13...3.24 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR)
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index a1b2149..77a0048 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -458,6 +458,14 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog)
}
}
+void cmCursesMainForm::Write()
+{
+ this->FillCacheManagerFromUI();
+ this->CMakeInstance->SaveCache(
+ this->CMakeInstance->GetHomeOutputDirectory());
+ this->LoadCache(nullptr);
+}
+
int cmCursesMainForm::Configure(int noconfigure)
{
this->ResetOutputs();
@@ -471,10 +479,7 @@ int cmCursesMainForm::Configure(int noconfigure)
}
// always save the current gui values to disk
- this->FillCacheManagerFromUI();
- this->CMakeInstance->SaveCache(
- this->CMakeInstance->GetHomeOutputDirectory());
- this->LoadCache(nullptr);
+ this->Write();
// run the generate process
this->OkToGenerate = true;
@@ -794,6 +799,21 @@ void cmCursesMainForm::HandleInput()
else if (key == KEY_PPAGE || key == ctrl('u')) {
form_driver(this->Form, REQ_PREV_PAGE);
}
+ // first entry
+ else if (key == KEY_HOME) {
+ form_driver(this->Form, REQ_FIRST_PAGE);
+ form_driver(this->Form, REQ_FIRST_FIELD);
+ }
+ // last entry
+ else if (key == KEY_END) {
+ form_driver(this->Form, REQ_LAST_PAGE);
+ form_driver(this->Form, REQ_LAST_FIELD);
+ }
+ // write and quit
+ else if (key == 'w') {
+ this->Write();
+ break;
+ }
// configure
else if (key == 'c') {
this->Configure();
@@ -854,6 +874,10 @@ void cmCursesMainForm::HandleInput()
if (!this->OldSearchString.empty()) {
this->JumpToCacheEntry(this->OldSearchString.c_str());
}
+ } else if (key == 'N') {
+ if (!this->OldSearchString.empty()) {
+ this->JumpToCacheEntry(this->OldSearchString.c_str(), true);
+ }
}
// switch advanced on/off
else if (key == 't') {
@@ -945,6 +969,11 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/)
void cmCursesMainForm::JumpToCacheEntry(const char* astr)
{
+ this->JumpToCacheEntry(astr, false);
+}
+
+void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse)
+{
std::string str;
if (astr) {
str = cmSystemTools::LowerCase(astr);
@@ -973,12 +1002,21 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr)
}
}
}
- if (static_cast<size_t>(findex) >= 3 * this->NumberOfVisibleEntries - 1) {
- set_current_field(this->Form, this->Fields[2]);
- } else if (new_page(this->Fields[findex + 1])) {
- form_driver(this->Form, REQ_NEXT_PAGE);
+ if (!reverse &&
+ static_cast<size_t>(findex) >= 3 * this->NumberOfVisibleEntries - 1) {
+ form_driver(this->Form, REQ_FIRST_PAGE);
+ form_driver(this->Form, REQ_FIRST_FIELD);
+ } else if (reverse && static_cast<size_t>(findex) < 3) {
+ form_driver(this->Form, REQ_LAST_PAGE);
+ form_driver(this->Form, REQ_LAST_FIELD);
+ } else if (this->Fields[findex + (reverse ? -3 : 1)]->page !=
+ this->Fields[findex]->page) {
+ form_driver(this->Form, reverse ? REQ_PREV_PAGE : REQ_NEXT_PAGE);
+ if (reverse) {
+ form_driver(this->Form, REQ_LAST_FIELD);
+ }
} else {
- form_driver(this->Form, REQ_NEXT_FIELD);
+ form_driver(this->Form, reverse ? REQ_PREV_FIELD : REQ_NEXT_FIELD);
}
cur = current_field(this->Form);
findex = field_index(cur);
@@ -1040,15 +1078,21 @@ const char* cmCursesMainForm::s_ConstHelpMessage =
"hit 'g' to have CMake generate all the build files (i.e. makefiles or "
"project files) and exit. "
"At any point during the process, you can exit ccmake with 'q'. However, "
- "this will not generate/change any build files.\n\n"
+ "this will not generate/change any build files. Additionally, you can exit "
+ "ccmake with 'w' to write changes to the cache file without generating or "
+ "changing the build files.\n\n"
"ccmake KEYS:\n\n"
"Navigation: "
"You can use the arrow keys and page up, down to navigate the options. "
- "Alternatively, you can use the following keys: \n"
+ "Additionally, you can use the following keys: \n"
" C-n or j : next option\n"
" C-p or k : previous options\n"
" C-d : down one page\n"
- " C-u : up one page\n\n"
+ " C-u : up one page\n"
+ " Home : jump to first option\n"
+ " End : jump to last option\n"
+ " n : next search result\n"
+ " N : previous search result\n\n"
"Editing options: "
"To change an option press enter or return. If the current options is a "
"boolean, this will toggle its value. "
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 112b7e8..1ce75e7 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -87,6 +87,11 @@ public:
void AddError(const std::string& message, const char* title) override;
/**
+ * Write files to cache file without reconfiguring.
+ */
+ void Write();
+
+ /**
* Used to do a configure. If argument is specified, it does only the check
* and not configure.
*/
@@ -123,6 +128,7 @@ protected:
// Jump to the cache entry whose name matches the string.
void JumpToCacheEntry(const char* str);
+ void JumpToCacheEntry(const char* str, bool reverse);
// Clear and reset the output log and state
void ResetOutputs();
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 35f4c88..b2e3cad 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -11,6 +11,7 @@
#include "cmsys/Directory.hxx"
#include "cmExecutionStatus.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
@@ -67,7 +68,7 @@ bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
if (!sourceListValue.empty()) {
sourceListValue += ";";
}
- sourceListValue += cmJoin(files, ";");
+ sourceListValue += cmList::to_string(files);
mf.AddDefinition(args[1], sourceListValue);
return true;
}
diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
index 566e4a4..8043f82 100644
--- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx
@@ -10,6 +10,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::
cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool(
@@ -35,7 +36,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo(
builder.AddCommand(command);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::ostringstream e;
e << "Failed to start objdump process for:\n " << file;
this->SetError(e.str());
@@ -46,7 +47,8 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo(
static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$");
static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$");
static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$");
- while (std::getline(*process.OutputStream(), line)) {
+ cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
+ while (std::getline(output, line)) {
cmsys::RegularExpressionMatch match;
if (neededRegex.find(line.c_str(), match)) {
needed.push_back(match.match(1));
@@ -73,8 +75,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo(
this->SetError(e.str());
return false;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
+ if (process.GetStatus(0).ExitStatus != 0) {
std::ostringstream e;
e << "Failed to run objdump on:\n " << file;
this->SetError(e.str());
diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
index 6d97720..4c35841 100644
--- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx
@@ -9,6 +9,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::
cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool(
@@ -34,7 +35,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
.AddCommand(command);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::ostringstream e;
e << "Failed to start otool process for:\n " << file;
this->SetError(e.str());
@@ -49,11 +50,12 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
"^ *path (.*) \\(offset [0-9]+\\)$");
static const cmsys::RegularExpression nameRegex(
"^ *name (.*) \\(offset [0-9]+\\)$");
- while (std::getline(*process.OutputStream(), line)) {
+ cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
+ while (std::getline(output, line)) {
cmsys::RegularExpressionMatch cmdMatch;
if (rpathRegex.find(line.c_str(), cmdMatch)) {
- if (!std::getline(*process.OutputStream(), line) ||
- !std::getline(*process.OutputStream(), line)) {
+ // NOLINTNEXTLINE(misc-redundant-expression)
+ if (!std::getline(output, line) || !std::getline(output, line)) {
this->SetError("Invalid output from otool");
return false;
}
@@ -66,8 +68,8 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
return false;
}
} else if (loadDylibRegex.find(line.c_str(), cmdMatch)) {
- if (!std::getline(*process.OutputStream(), line) ||
- !std::getline(*process.OutputStream(), line)) {
+ // NOLINTNEXTLINE(misc-redundant-expression)
+ if (!std::getline(output, line) || !std::getline(output, line)) {
this->SetError("Invalid output from otool");
return false;
}
@@ -88,8 +90,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo(
this->SetError(e.str());
return false;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
+ if (process.GetStatus(0).ExitStatus != 0) {
std::ostringstream e;
e << "Failed to run otool on:\n " << file;
this->SetError(e.str());
diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
index f342884..cd21140 100644
--- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx
@@ -9,6 +9,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::
cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool(
@@ -33,7 +34,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
builder.AddCommand(command);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::ostringstream e;
e << "Failed to start dumpbin process for:\n " << file;
this->SetError(e.str());
@@ -43,7 +44,8 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
std::string line;
static const cmsys::RegularExpression regex(
"^ ([^\n]*\\.[Dd][Ll][Ll])\r$");
- while (std::getline(*process.OutputStream(), line)) {
+ cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
+ while (std::getline(output, line)) {
cmsys::RegularExpressionMatch match;
if (regex.find(line.c_str(), match)) {
needed.push_back(match.match(1));
@@ -56,8 +58,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo(
this->SetError(e.str());
return false;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
+ if (process.GetStatus(0).ExitStatus != 0) {
std::ostringstream e;
e << "Failed to run dumpbin on:\n " << file;
this->SetError(e.str());
diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
index f14de55..d95da95 100644
--- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
+++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx
@@ -10,6 +10,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::
cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool(
@@ -34,7 +35,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
builder.AddCommand(command);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::ostringstream e;
e << "Failed to start objdump process for:\n " << file;
this->SetError(e.str());
@@ -44,7 +45,8 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
std::string line;
static const cmsys::RegularExpression regex(
"^\t*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])$");
- while (cmSystemTools::GetLineFromStream(*process.OutputStream(), line)) {
+ cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
+ while (cmSystemTools::GetLineFromStream(output, line)) {
cmsys::RegularExpressionMatch match;
if (regex.find(line.c_str(), match)) {
needed.push_back(match.match(1));
@@ -57,8 +59,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo(
this->SetError(e.str());
return false;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
+ if (process.GetStatus(0).ExitStatus != 0) {
std::ostringstream e;
e << "Failed to run objdump on:\n " << file;
this->SetError(e.str());
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 1c00f15..81ed41f 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -529,12 +529,12 @@ bool QueryWindowsRegistry(Range args, cmExecutionStatus& status,
if (arguments.ValueNames) {
auto result = registry.GetValueNames(key, view);
if (result) {
- makefile.AddDefinition(variable, cmJoin(*result, ";"_s));
+ makefile.AddDefinition(variable, cmList::to_string(*result));
}
} else if (arguments.SubKeys) {
auto result = registry.GetSubKeys(key, view);
if (result) {
- makefile.AddDefinition(variable, cmJoin(*result, ";"_s));
+ makefile.AddDefinition(variable, cmList::to_string(*result));
}
} else {
auto result =
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index b80b3cb..04e4fc7 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1579,7 +1579,9 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
this->OldLinkDirItems.push_back(item.Value);
}
- if (target->IsFrameworkOnApple()) {
+ const bool isImportedFrameworkFolderOnApple =
+ target->IsImportedFrameworkFolderOnApple(this->Config);
+ if (target->IsFrameworkOnApple() || isImportedFrameworkFolderOnApple) {
// Add the framework directory and the framework item itself
auto fwDescriptor = this->GlobalGenerator->SplitFrameworkPath(
item.Value, cmGlobalGenerator::FrameworkFormat::Extended);
@@ -1597,16 +1599,33 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
}
if (this->GlobalGenerator->IsXcode()) {
- this->Items.emplace_back(
- item, ItemIsPath::Yes, target,
- this->FindLibraryFeature(entry.Feature == DEFAULT
- ? "__CMAKE_LINK_FRAMEWORK"
- : entry.Feature));
+ if (isImportedFrameworkFolderOnApple) {
+ if (entry.Feature == DEFAULT) {
+ this->AddLibraryFeature("FRAMEWORK");
+ this->Items.emplace_back(item, ItemIsPath::Yes, target,
+ this->FindLibraryFeature("FRAMEWORK"));
+ } else {
+ this->Items.emplace_back(item, ItemIsPath::Yes, target,
+ this->FindLibraryFeature(entry.Feature));
+ }
+ } else {
+ this->Items.emplace_back(
+ item, ItemIsPath::Yes, target,
+ this->FindLibraryFeature(entry.Feature == DEFAULT
+ ? "__CMAKE_LINK_FRAMEWORK"
+ : entry.Feature));
+ }
} else {
if (cmHasSuffix(entry.Feature, "FRAMEWORK"_s)) {
this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes,
target,
this->FindLibraryFeature(entry.Feature));
+ } else if (entry.Feature == DEFAULT &&
+ isImportedFrameworkFolderOnApple) {
+ this->AddLibraryFeature("FRAMEWORK");
+ this->Items.emplace_back(fwDescriptor->GetLinkName(), ItemIsPath::Yes,
+ target,
+ this->FindLibraryFeature("FRAMEWORK"));
} else {
this->Items.emplace_back(
item, ItemIsPath::Yes, target,
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx
index e836a2a..e6c10c6 100644
--- a/Source/cmCxxModuleMapper.cxx
+++ b/Source/cmCxxModuleMapper.cxx
@@ -74,8 +74,62 @@ CxxBmiLocation CxxModuleLocations::BmiGeneratorPathForModule(
namespace {
+struct TransitiveUsage
+{
+ TransitiveUsage(std::string name, std::string location, LookupMethod method)
+ : LogicalName(std::move(name))
+ , Location(std::move(location))
+ , Method(method)
+ {
+ }
+
+ std::string LogicalName;
+ std::string Location;
+ LookupMethod Method;
+};
+
+std::vector<TransitiveUsage> GetTransitiveUsages(
+ CxxModuleLocations const& loc, std::vector<cmSourceReqInfo> const& required,
+ CxxModuleUsage const& usages)
+{
+ std::set<std::string> transitive_usage_directs;
+ std::set<std::string> transitive_usage_names;
+
+ std::vector<TransitiveUsage> all_usages;
+
+ for (auto const& r : required) {
+ auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName);
+ if (bmi_loc.IsKnown()) {
+ all_usages.emplace_back(r.LogicalName, bmi_loc.Location(), r.Method);
+ transitive_usage_directs.insert(r.LogicalName);
+
+ // Insert transitive usages.
+ auto transitive_usages = usages.Usage.find(r.LogicalName);
+ if (transitive_usages != usages.Usage.end()) {
+ transitive_usage_names.insert(transitive_usages->second.begin(),
+ transitive_usages->second.end());
+ }
+ }
+ }
+
+ for (auto const& transitive_name : transitive_usage_names) {
+ if (transitive_usage_directs.count(transitive_name)) {
+ continue;
+ }
+
+ auto module_ref = usages.Reference.find(transitive_name);
+ if (module_ref != usages.Reference.end()) {
+ all_usages.emplace_back(transitive_name, module_ref->second.Path,
+ module_ref->second.Method);
+ }
+ }
+
+ return all_usages;
+}
+
std::string CxxModuleMapContentClang(CxxModuleLocations const& loc,
- cmScanDepInfo const& obj)
+ cmScanDepInfo const& obj,
+ CxxModuleUsage const& usages)
{
std::stringstream mm;
@@ -98,12 +152,11 @@ std::string CxxModuleMapContentClang(CxxModuleLocations const& loc,
break;
}
}
- for (auto const& r : obj.Requires) {
- auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName);
- if (bmi_loc.IsKnown()) {
- mm << "-fmodule-file=" << r.LogicalName << "=" << bmi_loc.Location()
- << '\n';
- }
+
+ auto all_usages = GetTransitiveUsages(loc, obj.Requires, usages);
+ for (auto const& usage : all_usages) {
+ mm << "-fmodule-file=" << usage.LogicalName << '=' << usage.Location
+ << '\n';
}
return mm.str();
@@ -122,7 +175,7 @@ std::string CxxModuleMapContentGcc(CxxModuleLocations const& loc,
// generate any).
// Write the root directory to use for module paths.
- mm << "$root " << loc.RootDirectory << "\n";
+ mm << "$root " << loc.RootDirectory << '\n';
for (auto const& p : obj.Provides) {
auto bmi_loc = loc.BmiGeneratorPathForModule(p.LogicalName);
@@ -180,37 +233,11 @@ std::string CxxModuleMapContentMsvc(CxxModuleLocations const& loc,
}
}
- std::set<std::string> transitive_usage_directs;
- std::set<std::string> transitive_usage_names;
-
- for (auto const& r : obj.Requires) {
- auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName);
- if (bmi_loc.IsKnown()) {
- auto flag = flag_for_method(r.Method);
-
- mm << flag << ' ' << r.LogicalName << '=' << bmi_loc.Location() << "\n";
- transitive_usage_directs.insert(r.LogicalName);
-
- // Insert transitive usages.
- auto transitive_usages = usages.Usage.find(r.LogicalName);
- if (transitive_usages != usages.Usage.end()) {
- transitive_usage_names.insert(transitive_usages->second.begin(),
- transitive_usages->second.end());
- }
- }
- }
-
- for (auto const& transitive_name : transitive_usage_names) {
- if (transitive_usage_directs.count(transitive_name)) {
- continue;
- }
+ auto all_usages = GetTransitiveUsages(loc, obj.Requires, usages);
+ for (auto const& usage : all_usages) {
+ auto flag = flag_for_method(usage.Method);
- auto module_ref = usages.Reference.find(transitive_name);
- if (module_ref != usages.Reference.end()) {
- auto flag = flag_for_method(module_ref->second.Method);
- mm << flag << ' ' << transitive_name << '=' << module_ref->second.Path
- << "\n";
- }
+ mm << flag << ' ' << usage.LogicalName << '=' << usage.Location << '\n';
}
return mm.str();
@@ -393,7 +420,7 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
{
switch (format) {
case CxxModuleMapFormat::Clang:
- return CxxModuleMapContentClang(loc, obj);
+ return CxxModuleMapContentClang(loc, obj, usages);
case CxxModuleMapFormat::Gcc:
return CxxModuleMapContentGcc(loc, obj);
case CxxModuleMapFormat::Msvc:
diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx
index 1322b20..b2e85f2 100644
--- a/Source/cmDebuggerVariablesHelper.cxx
+++ b/Source/cmDebuggerVariablesHelper.cxx
@@ -10,7 +10,7 @@
#include <map>
#include <sstream>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmDebuggerStackFrame.h"
#include "cmDebuggerVariables.h"
@@ -578,17 +578,17 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny(
return {};
}
- auto makeFileEncodingString = [](codecvt::Encoding encoding) {
+ auto makeFileEncodingString = [](codecvt_Encoding encoding) {
switch (encoding) {
- case codecvt::Encoding::None:
+ case codecvt_Encoding::None:
return "None";
- case codecvt::Encoding::UTF8:
+ case codecvt_Encoding::UTF8:
return "UTF8";
- case codecvt::Encoding::UTF8_WITH_BOM:
+ case codecvt_Encoding::UTF8_WITH_BOM:
return "UTF8_WITH_BOM";
- case codecvt::Encoding::ANSI:
+ case codecvt_Encoding::ANSI:
return "ANSI";
- case codecvt::Encoding::ConsoleOutput:
+ case codecvt_Encoding::ConsoleOutput:
return "ConsoleOutput";
default:
return "Unknown";
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 7fbd826..3b98219 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -20,6 +20,7 @@
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmProcessOutput.h"
@@ -356,7 +357,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
}
status.GetMakefile().AddDefinition(arguments.ResultsVariable,
- cmJoin(res, ";"));
+ cmList::to_string(res));
} break;
case cmsysProcess_State_Exception:
status.GetMakefile().AddDefinition(
diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx
index 2f26627..0a746a9 100644
--- a/Source/cmExperimental.cxx
+++ b/Source/cmExperimental.cxx
@@ -27,7 +27,7 @@ struct FeatureData
bool Warned;
} LookupTable[] = {
// CxxModuleCMakeApi
- { "aa1f7df0-828a-4fcd-9afc-2dc80491aca7",
+ { "bf70d4b0-9fb7-465c-9803-34014e70d112",
"CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API",
"CMake's C++ module support is experimental. It is meant only for "
"experimentation and feedback to CMake developers.",
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index df26bad..8d3960c 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmList.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -237,7 +238,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
}
// Store the property.
- properties[prop] = cmJoin(objects, ";");
+ properties[prop] = cmList::to_string(objects);
} else {
// Add the main target file.
{
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 22276ae..481c98f 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -383,7 +383,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmGeneratorExpression ge(*target->Makefile->GetCMakeInstance());
std::string dirs = cmGeneratorExpression::Preprocess(
- cmJoin(target->Target->GetInstallIncludeDirectoriesEntries(te), ";"),
+ cmList::to_string(target->Target->GetInstallIncludeDirectoriesEntries(te)),
preprocessRule, true);
this->ReplaceInstallPrefix(dirs);
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
@@ -955,13 +955,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
// Isolate the file policy level.
// Support CMake versions as far back as 2.6 but also support using NEW
- // policy settings for up to CMake 3.25 (this upper limit may be reviewed
+ // policy settings for up to CMake 3.26 (this upper limit may be reviewed
// and increased from time to time). This reduces the opportunity for CMake
// warnings when an older export file is later used with newer CMake
// versions.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION 2.8.3...3.25)\n";
+ << "cmake_policy(VERSION 2.8.3...3.26)\n";
/* clang-format on */
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 538c883..264c947 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmInstallExportGenerator.h"
#include "cmInstallFileSetGenerator.h"
#include "cmInstallTargetGenerator.h"
+#include "cmList.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -430,7 +431,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
}
// Store the property.
- properties[prop] = cmJoin(objects, ";");
+ properties[prop] = cmList::to_string(objects);
importedLocations.insert(prop);
} else {
if (target->IsFrameworkOnApple() && target->HasImportLibrary(config)) {
@@ -590,10 +591,12 @@ std::string cmExportInstallFileGenerator::GetFileSetDirectories(
auto cge = ge.Parse(te->FileSetGenerators.at(fileSet)->GetDestination());
for (auto const& config : configs) {
- auto dest = cmStrCat("${_IMPORT_PREFIX}/",
- cmOutputConverter::EscapeForCMake(
- cge->Evaluate(gte->LocalGenerator, config, gte),
- cmOutputConverter::WrapQuotes::NoWrap));
+ auto unescapedDest = cge->Evaluate(gte->LocalGenerator, config, gte);
+ auto dest = cmOutputConverter::EscapeForCMake(
+ unescapedDest, cmOutputConverter::WrapQuotes::NoWrap);
+ if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
+ dest = cmStrCat("${_IMPORT_PREFIX}/", dest);
+ }
auto const& type = fileSet->GetType();
// C++ modules do not support interface file sets which are dependent upon
@@ -645,11 +648,14 @@ std::string cmExportInstallFileGenerator::GetFileSetFiles(
fileSet->EvaluateFileEntry(directories, files, entry,
gte->LocalGenerator, config, gte);
}
- auto dest = cmStrCat("${_IMPORT_PREFIX}/",
- cmOutputConverter::EscapeForCMake(
- destCge->Evaluate(gte->LocalGenerator, config, gte),
- cmOutputConverter::WrapQuotes::NoWrap),
- '/');
+ auto unescapedDest = destCge->Evaluate(gte->LocalGenerator, config, gte);
+ auto dest =
+ cmStrCat(cmOutputConverter::EscapeForCMake(
+ unescapedDest, cmOutputConverter::WrapQuotes::NoWrap),
+ '/');
+ if (!cmSystemTools::FileIsFullPath(unescapedDest)) {
+ dest = cmStrCat("${_IMPORT_PREFIX}/", dest);
+ }
bool const contextSensitive = destCge->GetHadContextSensitiveCondition() ||
std::any_of(directoryEntries.begin(), directoryEntries.end(),
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index f30c3c3..7e525d5 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -156,12 +156,12 @@ std::string cmExportTryCompileFileGenerator::GetFileSetDirectories(
cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
{
return cmOutputConverter::EscapeForCMake(
- cmJoin(fileSet->GetDirectoryEntries(), ";"));
+ cmList::to_string(fileSet->GetDirectoryEntries()));
}
std::string cmExportTryCompileFileGenerator::GetFileSetFiles(
cmGeneratorTarget* /*gte*/, cmFileSet* fileSet, cmTargetExport* /*te*/)
{
return cmOutputConverter::EscapeForCMake(
- cmJoin(fileSet->GetFileEntries(), ";"));
+ cmList::to_string(fileSet->GetFileEntries()));
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 45fba8b..def09fe 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -42,6 +42,7 @@
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmHexFileConverter.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -805,7 +806,7 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
std::sort(files.begin(), files.end());
files.erase(std::unique(files.begin(), files.end()), files.end());
- status.GetMakefile().AddDefinition(variable, cmJoin(files, ";"));
+ status.GetMakefile().AddDefinition(variable, cmList::to_string(files));
return true;
}
@@ -1556,7 +1557,7 @@ bool HandlePathCommand(std::vector<std::string> const& args,
#endif
std::vector<std::string> path = cmSystemTools::SplitString(args[1], pathSep);
- std::string value = cmJoin(cmMakeRange(path).transform(convert), ";");
+ std::string value = cmList::to_string(cmMakeRange(path).transform(convert));
status.GetMakefile().AddDefinition(args[2], value);
return true;
}
@@ -3157,7 +3158,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
if (!parsedArgs.RPathPrefix.empty()) {
status.GetMakefile().AddDefinition(
parsedArgs.RPathPrefix + "_" + firstPath,
- cmJoin(archive.GetRPaths().at(firstPath), ";"));
+ cmList::to_string(archive.GetRPaths().at(firstPath)));
}
} else if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
conflictingDeps.push_back(val.first);
@@ -3165,7 +3166,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
paths.insert(paths.begin(), val.second.begin(), val.second.end());
std::string varName =
parsedArgs.ConflictingDependenciesPrefix + "_" + val.first;
- std::string pathsStr = cmJoin(paths, ";");
+ std::string pathsStr = cmList::to_string(paths);
status.GetMakefile().AddDefinition(varName, pathsStr);
} else {
std::ostringstream e;
@@ -3196,17 +3197,17 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
}
if (!parsedArgs.ResolvedDependenciesVar.empty()) {
- std::string val = cmJoin(deps, ";");
+ std::string val = cmList::to_string(deps);
status.GetMakefile().AddDefinition(parsedArgs.ResolvedDependenciesVar,
val);
}
if (!parsedArgs.UnresolvedDependenciesVar.empty()) {
- std::string val = cmJoin(unresolvedDeps, ";");
+ std::string val = cmList::to_string(unresolvedDeps);
status.GetMakefile().AddDefinition(parsedArgs.UnresolvedDependenciesVar,
val);
}
if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
- std::string val = cmJoin(conflictingDeps, ";");
+ std::string val = cmList::to_string(conflictingDeps);
status.GetMakefile().AddDefinition(
parsedArgs.ConflictingDependenciesPrefix + "_FILENAMES", val);
}
diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx
index 5d197d2..548e327 100644
--- a/Source/cmFileLock.cxx
+++ b/Source/cmFileLock.cxx
@@ -12,11 +12,7 @@
cmFileLock::cmFileLock(cmFileLock&& other) noexcept
{
this->File = other.File;
-#if defined(_WIN32)
- other.File = INVALID_HANDLE_VALUE;
-#else
- other.File = -1;
-#endif
+ other.File = (decltype(other.File))-1;
this->Filename = std::move(other.Filename);
}
@@ -32,11 +28,7 @@ cmFileLock::~cmFileLock()
cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept
{
this->File = other.File;
-#if defined(_WIN32)
- other.File = INVALID_HANDLE_VALUE;
-#else
- other.File = -1;
-#endif
+ other.File = (decltype(other.File))-1;
this->Filename = std::move(other.Filename);
return *this;
diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h
index 94baea1..0f2e7d9 100644
--- a/Source/cmFileLock.h
+++ b/Source/cmFileLock.h
@@ -7,7 +7,7 @@
#include <string>
#if defined(_WIN32)
-# include <windows.h> // HANDLE
+using HANDLE = void*;
#endif
class cmFileLockResult;
@@ -53,8 +53,8 @@ private:
cmFileLockResult LockWithTimeout(unsigned long timeoutSec);
#if defined(_WIN32)
- HANDLE File = INVALID_HANDLE_VALUE;
- BOOL LockFile(DWORD flags);
+ HANDLE File = (HANDLE)-1;
+ int LockFile(int flags);
#else
int File = -1;
int LockFile(int cmd, int type) const;
diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx
index b7f7f38..632c0e9 100644
--- a/Source/cmFileLockResult.cxx
+++ b/Source/cmFileLockResult.cxx
@@ -5,6 +5,10 @@
#include <cerrno>
#include <cstring>
+#ifdef _WIN32
+# include <Windows.h>
+#endif
+
cmFileLockResult cmFileLockResult::MakeOk()
{
return { OK, 0 };
diff --git a/Source/cmFileLockResult.h b/Source/cmFileLockResult.h
index 8a58d1f..e252de7 100644
--- a/Source/cmFileLockResult.h
+++ b/Source/cmFileLockResult.h
@@ -6,10 +6,6 @@
#include <string>
-#if defined(_WIN32)
-# include <windows.h> // DWORD
-#endif
-
/**
* @brief Result of the locking/unlocking file.
* @note See @c cmFileLock
@@ -17,11 +13,7 @@
class cmFileLockResult
{
public:
-#if defined(_WIN32)
- using Error = DWORD;
-#else
using Error = int;
-#endif
/**
* @brief Successful lock/unlock.
diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx
index 7bee5f2..244ade2 100644
--- a/Source/cmFileLockWin32.cxx
+++ b/Source/cmFileLockWin32.cxx
@@ -78,7 +78,7 @@ cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds)
}
}
-BOOL cmFileLock::LockFile(DWORD flags)
+int cmFileLock::LockFile(int flags)
{
const DWORD reserved = 0;
const unsigned long len = static_cast<unsigned long>(-1);
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 9eb0603..6a571b4 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -251,8 +251,14 @@ struct cmFindLibraryHelper
void DebugLibraryFailed(std::string const& name, std::string const& path)
{
if (this->DebugMode) {
- auto regexName =
- cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr);
+ // To improve readability of the debug output, if there is only one
+ // prefix/suffix, use the plain prefix/suffix instead of the regex.
+ const auto& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0]
+ : this->PrefixRegexStr;
+ const auto& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0]
+ : this->SuffixRegexStr;
+
+ auto regexName = cmStrCat(prefix, name, suffix);
this->DebugSearches.FailedAt(path, regexName);
}
}
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index f4768b6..8d2d972 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -11,6 +11,7 @@
#include "cmExecutionStatus.h"
#include "cmFunctionBlocker.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
@@ -89,9 +90,9 @@ bool cmFunctionHelperCommand::operator()(
}
// define ARGV and ARGN
- auto const argvDef = cmJoin(expandedArgs, ";");
+ auto const argvDef = cmList::to_string(expandedArgs);
auto const eit = expandedArgs.begin() + (this->Args.size() - 1);
- auto const argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
+ auto const argnDef = cmList::to_string(cmMakeRange(eit, expandedArgs.end()));
makefile.AddDefinition(ARGV, argvDef);
makefile.MarkVariableAsUsed(ARGV);
makefile.AddDefinition(ARGN, argnDef);
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 133bf5f..e669f68 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -16,7 +16,7 @@
cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
{
#ifndef CMAKE_BOOTSTRAP
- if (encoding != codecvt::None) {
+ if (encoding != codecvt_Encoding::None) {
this->imbue(std::locale(this->getloc(), new codecvt(encoding)));
}
#else
@@ -35,13 +35,13 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
cmSystemTools::ReportLastSystemError("");
}
#ifndef CMAKE_BOOTSTRAP
- if (encoding != codecvt::None) {
+ if (encoding != codecvt_Encoding::None) {
this->imbue(std::locale(this->getloc(), new codecvt(encoding)));
}
#else
static_cast<void>(encoding);
#endif
- if (encoding == codecvt::UTF8_WITH_BOM) {
+ if (encoding == codecvt_Encoding::UTF8_WITH_BOM) {
// Write the BOM encoding header into the file
char magic[] = { static_cast<char>(0xEF), static_cast<char>(0xBB),
static_cast<char>(0xBF) };
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index bfc121f..a26616d 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -8,7 +8,7 @@
#include "cmsys/FStream.hxx"
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
// This is the first base class of cmGeneratedFileStream. It will be
// created before and destroyed after the ofstream portion and can
@@ -77,13 +77,13 @@ class cmGeneratedFileStream
{
public:
using Stream = cmsys::ofstream;
- using Encoding = codecvt::Encoding;
+ using Encoding = codecvt_Encoding;
/**
* This constructor prepares a default stream. The open method must
* be used before writing to the stream.
*/
- cmGeneratedFileStream(Encoding encoding = codecvt::None);
+ cmGeneratedFileStream(codecvt_Encoding encoding = codecvt_Encoding::None);
/**
* This constructor takes the name of the file to be generated. It
@@ -92,7 +92,7 @@ public:
* second argument is set to true.
*/
cmGeneratedFileStream(std::string const& name, bool quiet = false,
- Encoding encoding = codecvt::None);
+ codecvt_Encoding encoding = codecvt_Encoding::None);
/**
* The destructor checks the stream status to be sure the temporary
@@ -151,5 +151,5 @@ public:
* Write a specific string using an alternate encoding.
* Afterward, the original encoding is restored.
*/
- void WriteAltEncoding(std::string const& data, Encoding encoding);
+ void WriteAltEncoding(std::string const& data, codecvt_Encoding encoding);
};
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 7fe814a..30798a3 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -2540,7 +2540,7 @@ static const struct LinkLibraryNode : public cmGeneratorExpressionNode
list.front() = LL_BEGIN;
list.push_back(LL_END);
- return cmJoin(list, ";"_s);
+ return list.to_string();
}
} linkLibraryNode;
@@ -2609,7 +2609,7 @@ static const struct LinkGroupNode : public cmGeneratorExpressionNode
list.front() = LG_BEGIN;
list.push_back(LG_END);
- return cmJoin(list, ";"_s);
+ return list.to_string();
}
} linkGroupNode;
@@ -2634,7 +2634,7 @@ static const struct HostLinkNode : public cmGeneratorExpressionNode
}
return context->HeadTarget->IsDeviceLink() ? std::string()
- : cmJoin(parameters, ";");
+ : cmList::to_string(parameters);
}
} hostLinkNode;
@@ -2669,7 +2669,7 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
list.insert(list.begin(), static_cast<std::string>(DL_BEGIN));
list.push_back(static_cast<std::string>(DL_END));
- return cmJoin(list, ";");
+ return list.to_string();
}
return std::string();
@@ -3106,7 +3106,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
mf->AddTargetObject(tgtName, o);
}
- return cmJoin(objects, ";");
+ return objects.to_string();
}
} targetObjectsNode;
@@ -3166,7 +3166,7 @@ static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
std::vector<std::string> dlls = CollectDlls(parameters, context, content);
- return cmJoin(dlls, ";");
+ return cmList::to_string(dlls);
}
} targetRuntimeDllsNode;
@@ -3189,7 +3189,7 @@ static const struct TargetRuntimeDllDirsNode : public TargetRuntimeDllsBaseNode
dllDirs.push_back(directory);
}
}
- return cmJoin(dllDirs, ";");
+ return cmList::to_string(dllDirs);
}
} targetRuntimeDllDirsNode;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 357d0a6..42be082 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -190,7 +190,7 @@ public:
}
static std::string filesStr;
- filesStr = cmJoin(files, ";");
+ filesStr = cmList::to_string(files);
return filesStr;
}
@@ -322,8 +322,7 @@ cmValue cmGeneratorTarget::GetSourcesProperty() const
values.push_back(se->GetInput());
}
static std::string value;
- value.clear();
- value = cmJoin(values, ";");
+ value = cmList::to_string(values);
return cmValue(value);
}
@@ -1493,9 +1492,9 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
}
std::string directories;
- if (const auto* interface = target->GetLinkInterfaceLibraries(
+ if (const auto* link_interface = target->GetLinkInterfaceLibraries(
config, root, LinkInterfaceFor::Usage)) {
- for (const cmLinkItem& library : interface->Libraries) {
+ for (const cmLinkItem& library : link_interface->Libraries) {
if (const cmGeneratorTarget* dependency = library.Target) {
if (cm::contains(dependency->GetAllConfigCompileLanguages(), lang)) {
auto* lg = dependency->GetLocalGenerator();
@@ -3828,7 +3827,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
if (lib.Target == nullptr) {
libDir = cmSystemTools::CollapseFullPath(
lib.AsStr(), this->Makefile->GetHomeOutputDirectory());
- } else if (lib.Target->Target->IsFrameworkOnApple()) {
+ } else if (lib.Target->Target->IsFrameworkOnApple() ||
+ this->IsImportedFrameworkFolderOnApple(config)) {
libDir = lib.Target->GetLocation(config);
} else {
continue;
@@ -8572,6 +8572,16 @@ bool cmGeneratorTarget::IsFrameworkOnApple() const
return this->Target->IsFrameworkOnApple();
}
+bool cmGeneratorTarget::IsImportedFrameworkFolderOnApple(
+ const std::string& config) const
+{
+ return this->IsApple() && this->IsImported() &&
+ (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::UNKNOWN_LIBRARY) &&
+ cmSystemTools::IsPathToFramework(this->GetLocation(config));
+}
+
bool cmGeneratorTarget::IsAppBundleOnApple() const
{
return this->Target->IsAppBundleOnApple();
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 78945c3..03452a1 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -812,6 +812,10 @@ public:
Apple. */
bool IsFrameworkOnApple() const;
+ /** Return whether this target is an IMPORTED library target on Apple
+ with a .framework folder as its location. */
+ bool IsImportedFrameworkFolderOnApple(const std::string& config) const;
+
/** Return whether this target is an executable Bundle on Apple. */
bool IsAppBundleOnApple() const;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 42bd206..d2c4fd6 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -6,9 +6,9 @@
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmState.h"
-#include "cmStringAlgorithms.h"
#include "cmValue.h"
// cmGetCMakePropertyCommand
@@ -35,7 +35,7 @@ bool cmGetCMakePropertyCommand(std::vector<std::string> const& args,
} else if (args[1] == "COMPONENTS") {
const std::set<std::string>* components =
status.GetMakefile().GetGlobalGenerator()->GetInstallComponents();
- output = cmJoin(*components, ";");
+ output = cmList::to_string(*components);
} else {
cmValue prop = nullptr;
if (!args[1].empty()) {
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 5175aae..3d7d5a7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -24,10 +24,6 @@
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# include <windows.h>
-#endif
-
#include "cmAlgorithms.h"
#include "cmCPackPropertiesGenerator.h"
#include "cmComputeTargetDepends.h"
@@ -142,6 +138,10 @@ cmGlobalGenerator::~cmGlobalGenerator()
{
this->ClearGeneratorMembers();
}
+codecvt_Encoding cmGlobalGenerator::GetMakefileEncoding() const
+{
+ return codecvt_Encoding::None;
+}
#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalGenerator::GetJson() const
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 9aefaff..bc59514 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -19,7 +19,7 @@
#include <cmext/algorithm>
#include <cmext/string_view>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmBuildOptions.h"
#include "cmCustomCommandLines.h"
@@ -120,10 +120,7 @@ public:
}
/** Get encoding used by generator for makefile files */
- virtual codecvt::Encoding GetMakefileEncoding() const
- {
- return codecvt::None;
- }
+ virtual codecvt_Encoding GetMakefileEncoding() const;
#if !defined(CMAKE_BOOTSTRAP)
/** Get a JSON object describing the generator. */
diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h
index 436ebca..bc8fc34 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.h
+++ b/Source/cmGlobalNMakeMakefileGenerator.h
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalUnixMakefileGenerator3.h"
@@ -38,9 +38,10 @@ public:
static std::string GetActualName() { return "NMake Makefiles"; }
/** Get encoding used by generator for makefile files */
- codecvt::Encoding GetMakefileEncoding() const override
+ codecvt_Encoding GetMakefileEncoding() const override
{
- return this->NMakeSupportsUTF8 ? codecvt::UTF8_WITH_BOM : codecvt::ANSI;
+ return this->NMakeSupportsUTF8 ? codecvt_Encoding::UTF8_WITH_BOM
+ : codecvt_Encoding::ANSI;
}
/** Get the documentation entry for this generator. */
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 97c9b70..e405909 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -566,7 +566,7 @@ std::unique_ptr<cmLocalGenerator> cmGlobalNinjaGenerator::CreateLocalGenerator(
cm::make_unique<cmLocalNinjaGenerator>(this, mf));
}
-codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const
+codecvt_Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const
{
return this->NinjaExpectedEncoding;
}
@@ -799,7 +799,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
if (this->NinjaSupportsCodePage) {
this->CheckNinjaCodePage();
} else {
- this->NinjaExpectedEncoding = codecvt::ANSI;
+ this->NinjaExpectedEncoding = codecvt_Encoding::ANSI;
}
#endif
}
@@ -830,9 +830,9 @@ void cmGlobalNinjaGenerator::CheckNinjaCodePage()
lineView.substr(cmStrLen("Build file encoding: "));
if (encoding == "UTF-8") {
// Ninja expects UTF-8. We use that internally. No conversion needed.
- this->NinjaExpectedEncoding = codecvt::None;
+ this->NinjaExpectedEncoding = codecvt_Encoding::None;
} else {
- this->NinjaExpectedEncoding = codecvt::ANSI;
+ this->NinjaExpectedEncoding = codecvt_Encoding::ANSI;
}
found = true;
break;
@@ -842,10 +842,10 @@ void cmGlobalNinjaGenerator::CheckNinjaCodePage()
this->GetCMakeInstance()->IssueMessage(
MessageType::WARNING,
"Could not determine Ninja's code page, defaulting to UTF-8");
- this->NinjaExpectedEncoding = codecvt::None;
+ this->NinjaExpectedEncoding = codecvt_Encoding::None;
}
} else {
- this->NinjaExpectedEncoding = codecvt::ANSI;
+ this->NinjaExpectedEncoding = codecvt_Encoding::ANSI;
}
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index bfbe57f..95d64e3 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -16,7 +16,7 @@
#include <cm/optional>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmBuildOptions.h"
#include "cmGeneratedFileStream.h"
@@ -192,7 +192,7 @@ public:
bool IsNinja() const override { return true; }
/** Get encoding used by generator for ninja files */
- codecvt::Encoding GetMakefileEncoding() const override;
+ codecvt_Encoding GetMakefileEncoding() const override;
static cmDocumentationEntry GetDocumentation();
@@ -590,7 +590,7 @@ private:
bool NinjaSupportsMetadataOnRegeneration = false;
bool NinjaSupportsCodePage = false;
- codecvt::Encoding NinjaExpectedEncoding = codecvt::None;
+ codecvt_Encoding NinjaExpectedEncoding = codecvt_Encoding::None;
bool DiagnosedCxxModuleNinjaSupport = false;
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 321f377..f1d04e5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1230,7 +1230,6 @@ const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const
{
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
return "4.0";
// in Visual Studio 2013 they detached the MSBuild tools version
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 3ad10eb..c4e1e11 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -8,156 +8,17 @@
#include <vector>
#include "cmGlobalGenerator.h"
-#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalVisualStudioGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-static const char vs11generatorName[] = "Visual Studio 11 2012";
-
-// Map generator name without year to name with year.
-static const char* cmVS11GenName(const std::string& name, std::string& genName)
-{
- if (strncmp(name.c_str(), vs11generatorName,
- sizeof(vs11generatorName) - 6) != 0) {
- return nullptr;
- }
- const char* p = name.c_str() + sizeof(vs11generatorName) - 6;
- if (cmHasLiteralPrefix(p, " 2012")) {
- p += 5;
- }
- genName = std::string(vs11generatorName) + p;
- return p;
-}
-
-class cmGlobalVisualStudio11Generator::Factory
- : public cmGlobalGeneratorFactory
-{
-public:
- std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
- const std::string& name, bool allowArch, cmake* cm) const override
- {
- std::string genName;
- const char* p = cmVS11GenName(name, genName);
- if (!p) {
- return std::unique_ptr<cmGlobalGenerator>();
- }
- if (!*p) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio11Generator(cm, genName, ""));
- }
- if (!allowArch || *p++ != ' ') {
- return std::unique_ptr<cmGlobalGenerator>();
- }
- if (strcmp(p, "Win64") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio11Generator(cm, genName, "x64"));
- }
- if (strcmp(p, "ARM") == 0) {
- return std::unique_ptr<cmGlobalGenerator>(
- new cmGlobalVisualStudio11Generator(cm, genName, "ARM"));
- }
-
- std::set<std::string> installedSDKs =
- cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
-
- if (installedSDKs.find(p) == installedSDKs.end()) {
- return std::unique_ptr<cmGlobalGenerator>();
- }
-
- auto ret = std::unique_ptr<cmGlobalVisualStudio11Generator>(
- new cmGlobalVisualStudio11Generator(cm, name, p));
- ret->WindowsCEVersion = "8.00";
- return std::unique_ptr<cmGlobalGenerator>(std::move(ret));
- }
-
- cmDocumentationEntry GetDocumentation() const override
- {
- return { std::string(vs11generatorName) + " [arch]",
- "Deprecated. Generates Visual Studio 2012 project files. "
- "Optional [arch] can be \"Win64\" or \"ARM\"." };
- }
-
- std::vector<std::string> GetGeneratorNames() const override
- {
- std::vector<std::string> names;
- names.push_back(vs11generatorName);
- return names;
- }
-
- std::vector<std::string> GetGeneratorNamesWithPlatform() const override
- {
- std::vector<std::string> names;
- names.push_back(vs11generatorName + std::string(" ARM"));
- names.push_back(vs11generatorName + std::string(" Win64"));
-
- std::set<std::string> installedSDKs =
- cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
- for (std::string const& i : installedSDKs) {
- names.push_back(std::string(vs11generatorName) + " " + i);
- }
-
- return names;
- }
-
- bool SupportsToolset() const override { return true; }
- bool SupportsPlatform() const override { return true; }
-
- std::vector<std::string> GetKnownPlatforms() const override
- {
- std::vector<std::string> platforms;
- platforms.emplace_back("x64");
- platforms.emplace_back("Win32");
- platforms.emplace_back("ARM");
-
- std::set<std::string> installedSDKs =
- cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
- for (std::string const& i : installedSDKs) {
- platforms.emplace_back(i);
- }
-
- return platforms;
- }
-
- std::string GetDefaultPlatformName() const override { return "Win32"; }
-};
-
-std::unique_ptr<cmGlobalGeneratorFactory>
-cmGlobalVisualStudio11Generator::NewFactory()
-{
- return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory);
-}
-
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName)
{
- std::string vc11Express;
- this->ExpressEdition = cmSystemTools::ReadRegistryValue(
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;"
- "ProductDir",
- vc11Express, cmSystemTools::KeyWOW64_32);
- this->DefaultPlatformToolset = "v110";
- this->DefaultCLFlagTableName = "v11";
- this->DefaultCSharpFlagTableName = "v11";
- this->DefaultLibFlagTableName = "v11";
- this->DefaultLinkFlagTableName = "v11";
- this->DefaultMasmFlagTableName = "v11";
- this->DefaultRCFlagTableName = "v11";
- this->Version = VSVersion::VS11;
-}
-
-bool cmGlobalVisualStudio11Generator::MatchesGeneratorName(
- const std::string& name) const
-{
- std::string genName;
- if (cmVS11GenName(name, genName)) {
- return genName == this->GetName();
- }
- return false;
}
void cmGlobalVisualStudio11Generator::EnableLanguage(
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index fd25984..ad12c1f 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -13,7 +13,6 @@
#include "cmGlobalVisualStudio10Generator.h"
#include "cmTransformDepfile.h"
-class cmGlobalGeneratorFactory;
class cmMakefile;
class cmake;
@@ -21,10 +20,6 @@ class cmake;
class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator
{
public:
- static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory();
-
- bool MatchesGeneratorName(const std::string& name) const override;
-
void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
bool optional) override;
@@ -58,8 +53,4 @@ protected:
/** Return true if target system supports debugging deployment. */
bool TargetSystemSupportsDeployment() const override;
-
-private:
- class Factory;
- friend class Factory;
};
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index d417f9e..b7af31b 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -64,7 +64,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
return { std::string(vs12generatorName) + " [arch]",
- "Generates Visual Studio 2013 project files. "
+ "Deprecated. Generates Visual Studio 2013 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"." };
}
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b254777..203bb09 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -330,23 +330,23 @@ void cmGlobalVisualStudio7Generator::Generate()
}
}
- if (this->Version == VSVersion::VS11 &&
+ if (this->Version == VSVersion::VS12 &&
!this->CMakeInstance->GetIsInTryCompile()) {
- std::string cmakeWarnVS11;
+ std::string cmakeWarnVS12;
if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue(
- "CMAKE_WARN_VS11")) {
- this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS11");
- cmakeWarnVS11 = *cached;
+ "CMAKE_WARN_VS12")) {
+ this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS12");
+ cmakeWarnVS12 = *cached;
} else {
- cmSystemTools::GetEnv("CMAKE_WARN_VS11", cmakeWarnVS11);
+ cmSystemTools::GetEnv("CMAKE_WARN_VS12", cmakeWarnVS12);
}
- if (cmakeWarnVS11.empty() || !cmIsOff(cmakeWarnVS11)) {
+ if (cmakeWarnVS12.empty() || !cmIsOff(cmakeWarnVS12)) {
this->CMakeInstance->IssueMessage(
MessageType::WARNING,
- "The \"Visual Studio 11 2012\" generator is deprecated "
+ "The \"Visual Studio 12 2013\" generator is deprecated "
"and will be removed in a future version of CMake."
"\n"
- "Add CMAKE_WARN_VS11=OFF to the cache to disable this warning.");
+ "Add CMAKE_WARN_VS12=OFF to the cache to disable this warning.");
}
}
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6b024db..4d7571a 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -105,8 +105,6 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
return "9.0";
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
- return "11.0";
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return "12.0";
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -132,14 +130,6 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout)
fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n";
fout << "# Visual Studio 2008\n";
break;
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
- fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
- if (this->ExpressEdition) {
- fout << "# Visual Studio Express 2012 for Windows Desktop\n";
- } else {
- fout << "# Visual Studio 2012\n";
- }
- break;
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
if (this->ExpressEdition) {
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 52db98d..76713fa 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -10,7 +10,7 @@
#include <string>
#include <vector>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmGlobalGenerator.h"
#include "cmTargetDepend.h"
@@ -35,7 +35,6 @@ public:
enum class VSVersion : uint16_t
{
VS9 = 90,
- VS11 = 110,
VS12 = 120,
/* VS13 = 130 was skipped */
VS14 = 140,
@@ -120,9 +119,9 @@ public:
/** Get encoding used by generator for generated source files
*/
- codecvt::Encoding GetMakefileEncoding() const override
+ codecvt_Encoding GetMakefileEncoding() const override
{
- return codecvt::ANSI;
+ return codecvt_Encoding::ANSI;
}
class TargetSet : public std::set<cmGeneratorTarget const*>
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 602b42f..9fe66d3 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -127,8 +127,6 @@ static unsigned int VSVersionToMajor(
switch (v) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
return 9;
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
- return 11;
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return 12;
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -149,8 +147,6 @@ static const char* VSVersionToToolset(
switch (v) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
return "v90";
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
- return "v110";
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return "v120";
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -171,8 +167,6 @@ static std::string VSVersionToMajorString(
switch (v) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
return "9";
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
- return "11";
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return "12";
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -192,7 +186,6 @@ static const char* VSVersionToAndroidToolset(
{
switch (v) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return "";
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
@@ -493,7 +486,6 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(
std::string genName;
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
break;
@@ -761,7 +753,6 @@ cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision()
{
switch (this->Version) {
case cmGlobalVisualStudioGenerator::VSVersion::VS9:
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
return "";
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index fd58f75..0472631 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -5155,6 +5155,10 @@ std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
case cmMakefile::AppleSDK::WatchSimulator:
return "WATCHOS_DEPLOYMENT_TARGET";
+ case cmMakefile::AppleSDK::XROS:
+ case cmMakefile::AppleSDK::XRSimulator:
+ return "XROS_DEPLOYMENT_TARGET";
+
case cmMakefile::AppleSDK::MacOS:
default:
return "MACOSX_DEPLOYMENT_TARGET";
diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx
index 0752b33..154aa27 100644
--- a/Source/cmLDConfigLDConfigTool.cxx
+++ b/Source/cmLDConfigLDConfigTool.cxx
@@ -14,6 +14,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmSystemTools.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
cmLDConfigLDConfigTool::cmLDConfigLDConfigTool(
cmRuntimeDependencyArchive* archive)
@@ -43,14 +44,15 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT)
.AddCommand(ldConfigCommand);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
this->Archive->SetError("Failed to start ldconfig process");
return false;
}
std::string line;
static const cmsys::RegularExpression regex("^([^\t:]*):");
- while (std::getline(*process.OutputStream(), line)) {
+ cmUVPipeIStream output(process.GetLoop(), process.OutputStream());
+ while (std::getline(output, line)) {
cmsys::RegularExpressionMatch match;
if (regex.find(line.c_str(), match)) {
paths.push_back(match.match(1));
@@ -61,8 +63,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
this->Archive->SetError("Failed to wait on ldconfig process");
return false;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
+ if (process.GetStatus(0).ExitStatus != 0) {
this->Archive->SetError("Failed to run ldconfig");
return false;
}
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index 1ec071b..6775a60 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -6,6 +6,7 @@
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
@@ -39,7 +40,7 @@ bool cmLinkDirectoriesCommand(std::vector<std::string> const& args,
AddLinkDir(mf, *i, directories);
}
- mf.AddLinkDirectory(cmJoin(directories, ";"), before);
+ mf.AddLinkDirectory(cmList::to_string(directories), before);
return true;
}
diff --git a/Source/cmList.cxx b/Source/cmList.cxx
index 022fcd2..3835e59 100644
--- a/Source/cmList.cxx
+++ b/Source/cmList.cxx
@@ -19,6 +19,7 @@
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
+#include "cmListFileCache.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmStringReplaceHelper.h"
@@ -802,11 +803,6 @@ cmList& cmList::transform(TransformAction action,
return *this;
}
-std::string cmList::join(cm::string_view glue) const
-{
- return cmJoin(this->Values, glue);
-}
-
std::string& cmList::append(std::string& list, cm::string_view value)
{
if (list.empty()) {
@@ -1001,3 +997,8 @@ cmList::container_type::iterator cmList::Insert(
}
return container.begin() + delta;
}
+
+std::string const& cmList::ToString(BT<std::string> const& s)
+{
+ return s.Value;
+}
diff --git a/Source/cmList.h b/Source/cmList.h
index eba0400..dc5850a 100644
--- a/Source/cmList.h
+++ b/Source/cmList.h
@@ -22,6 +22,9 @@
#include "cmValue.h"
+template <typename T>
+class BT;
+
/**
* CMake lists management
* A CMake list is a string where list elements are separated by the ';'
@@ -936,7 +939,10 @@ public:
std::vector<std::string> const& args,
std::unique_ptr<TransformSelector> = {});
- std::string join(cm::string_view glue) const;
+ std::string join(cm::string_view glue) const
+ {
+ return cmList::Join(this->Values, glue);
+ }
void swap(cmList& other) noexcept { this->Values.swap(other.Values); }
@@ -1092,8 +1098,8 @@ public:
return cmList::append(list,
cm::string_view{ std::accumulate(
std::next(first), last, *first,
- [](std::string a, const std::string& b) {
- return std::move(a) +
+ [](const std::string& a, const std::string& b) {
+ return a +
std::string(cmList::element_separator) + b;
}) });
}
@@ -1116,6 +1122,13 @@ public:
}) });
}
+ template <typename Range,
+ cm::enable_if_t<cm::is_range<Range>::value, int> = 0>
+ static std::string to_string(Range const& r)
+ {
+ return cmList::Join(r, cmList::element_separator);
+ }
+
// Non-members
// ===========
friend inline bool operator==(const cmList& lhs, const cmList& rhs) noexcept
@@ -1185,6 +1198,27 @@ private:
return container.begin() + delta;
}
+ static std::string const& ToString(std::string const& s) { return s; }
+ static std::string ToString(cm::string_view s) { return std::string{ s }; }
+ static std::string const& ToString(BT<std::string> const&);
+
+ template <typename Range>
+ static std::string Join(Range const& r, cm::string_view glue)
+ {
+ if (cm::size(r) == 0) {
+ return std::string{};
+ }
+
+ const auto sep = std::string{ glue };
+
+ std::string joined = cmList::ToString(*std::begin(r));
+ for (auto it = std::next(std::begin(r)); it != std::end(r); ++it) {
+ joined += sep + cmList::ToString(*it);
+ }
+
+ return joined;
+ }
+
container_type Values;
};
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index af0e118..24ef5c2 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -198,7 +198,7 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target)
// Intel Fortran always uses VS9 format ".vfproj" files.
cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion();
if (this->FortranProject &&
- gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS11) {
+ gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS12) {
gg->SetVersion(cmGlobalVisualStudioGenerator::VSVersion::VS9);
}
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 759ee7b..eb05424 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -83,6 +83,12 @@ void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os)
case cmMakefile::AppleSDK::WatchSimulator:
platformName = "watchsimulator";
break;
+ case cmMakefile::AppleSDK::XROS:
+ platformName = "xros";
+ break;
+ case cmMakefile::AppleSDK::XRSimulator:
+ platformName = "xrsimulator";
+ break;
case cmMakefile::AppleSDK::MacOS:
break;
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 47ad749..3d7cd8b 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -12,6 +12,7 @@
#include "cmExecutionStatus.h"
#include "cmFunctionBlocker.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmPolicies.h"
@@ -66,8 +67,9 @@ bool cmMacroHelperCommand::operator()(
std::string argcDef = std::to_string(expandedArgs.size());
auto eit = expandedArgs.begin() + (this->Args.size() - 1);
- std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
- std::string expandedArgv = cmJoin(expandedArgs, ";");
+ std::string expandedArgn =
+ cmList::to_string(cmMakeRange(eit, expandedArgs.end()));
+ std::string expandedArgv = cmList::to_string(expandedArgs);
std::vector<std::string> variables;
variables.reserve(this->Args.size() - 1);
for (unsigned int j = 1; j < this->Args.size(); ++j) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0af0ed0..e1841b6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1980,7 +1980,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
return;
}
- std::string entryString = cmJoin(incs, ";");
+ std::string entryString = cmList::to_string(incs);
if (before) {
this->StateSnapshot.GetDirectory().PrependIncludeDirectoriesEntry(
BT<std::string>(entryString, this->Backtrace));
@@ -2565,6 +2565,8 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const
{ "iphonesimulator", AppleSDK::IPhoneSimulator },
{ "watchos", AppleSDK::WatchOS },
{ "watchsimulator", AppleSDK::WatchSimulator },
+ { "xros", AppleSDK::XROS },
+ { "xrsimulator", AppleSDK::XRSimulator },
};
for (auto const& entry : sdkDatabase) {
@@ -3004,12 +3006,11 @@ cm::optional<std::string> cmMakefile::DeferGetCallIds() const
{
cm::optional<std::string> ids;
if (this->Defer) {
- ids = cmJoin(
+ ids = cmList::to_string(
cmMakeRange(this->Defer->Commands)
.filter([](DeferCommand const& dc) -> bool { return !dc.Id.empty(); })
.transform(
- [](DeferCommand const& dc) -> std::string const& { return dc.Id; }),
- ";");
+ [](DeferCommand const& dc) -> std::string const& { return dc.Id; }));
}
return ids;
}
@@ -4160,7 +4161,7 @@ cmValue cmMakefile::GetProperty(const std::string& prop) const
std::transform(
t->Tests.begin(), t->Tests.end(), std::back_inserter(keys),
[](decltype(t->Tests)::value_type const& pair) { return pair.first; });
- output = cmJoin(keys, ";");
+ output = cmList::to_string(keys);
return cmValue(output);
}
@@ -4613,7 +4614,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0114 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0120 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7005942..79a98cd 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -561,6 +561,8 @@ public:
AppleTVSimulator,
WatchOS,
WatchSimulator,
+ XROS,
+ XRSimulator,
};
/** What SDK type points CMAKE_OSX_SYSROOT to? */
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5f27856..1dd48b3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -17,7 +17,7 @@
#include <cmext/algorithm>
#include <cmext/string_view>
-#include "cm_codecvt.hxx"
+#include "cm_codecvt_Encoding.hxx"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
@@ -2129,12 +2129,12 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
// FIXME: Find a better way to determine the response file encoding,
// perhaps using tool-specific platform information variables.
// For now, use the makefile encoding as a heuristic.
- codecvt::Encoding responseEncoding =
+ codecvt_Encoding responseEncoding =
this->GlobalGenerator->GetMakefileEncoding();
// Non-MSVC tooling doesn't understand BOM encoded files.
- if (responseEncoding == codecvt::UTF8_WITH_BOM &&
+ if (responseEncoding == codecvt_Encoding::UTF8_WITH_BOM &&
(language == "CUDA" || !this->Makefile->IsOn("MSVC"))) {
- responseEncoding = codecvt::UTF8;
+ responseEncoding = codecvt_Encoding::UTF8;
}
// Create the response file.
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index b0462f0..f193ed9 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -20,7 +20,9 @@
#include "cmSystemTools.h"
#include "cmValue.h"
-static std::string EscapeArg(const std::string& arg)
+namespace {
+
+std::string EscapeArg(const std::string& arg)
{
// replace ";" with "\;" so output argument lists will split correctly
std::string escapedArg;
@@ -33,14 +35,12 @@ static std::string EscapeArg(const std::string& arg)
return escapedArg;
}
-static std::string JoinList(std::vector<std::string> const& arg, bool escape)
+std::string JoinList(std::vector<std::string> const& arg, bool escape)
{
- return escape ? cmJoin(cmMakeRange(arg).transform(EscapeArg), ";")
- : cmJoin(cmMakeRange(arg), ";");
+ return escape ? cmList::to_string(cmMakeRange(arg).transform(EscapeArg))
+ : cmList::to_string(cmMakeRange(arg));
}
-namespace {
-
using options_map = std::map<std::string, bool>;
using single_map = std::map<std::string, std::string>;
using multi_map =
@@ -108,8 +108,9 @@ static void PassParsedArguments(
}
if (!keywordsMissingValues.empty()) {
- makefile.AddDefinition(prefix + "KEYWORDS_MISSING_VALUES",
- cmJoin(cmMakeRange(keywordsMissingValues), ";"));
+ makefile.AddDefinition(
+ prefix + "KEYWORDS_MISSING_VALUES",
+ cmList::to_string(cmMakeRange(keywordsMissingValues)));
} else {
makefile.RemoveDefinition(prefix + "KEYWORDS_MISSING_VALUES");
}
diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx
index 17285e7..3576e4f 100644
--- a/Source/cmSeparateArgumentsCommand.cxx
+++ b/Source/cmSeparateArgumentsCommand.cxx
@@ -9,6 +9,7 @@
#include "cmArgumentParser.h"
#include "cmExecutionStatus.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
@@ -159,7 +160,7 @@ bool cmSeparateArgumentsCommand(std::vector<std::string> const& args,
pos += 2;
}
});
- auto value = cmJoin(values, ";");
+ auto value = cmList::to_string(values);
status.GetMakefile().AddDefinition(var, value);
return true;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 040eb08..c4bb949 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -3,6 +3,7 @@
#include "cmSetCommand.h"
#include "cmExecutionStatus.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
@@ -103,7 +104,8 @@ bool cmSetCommand(std::vector<std::string> const& args,
}
// collect any values into a single semi-colon separated value list
- value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";");
+ value =
+ cmList::to_string(cmMakeRange(args).advance(1).retreat(ignoreLastArgs));
if (parentScope) {
status.GetMakefile().RaiseScope(variable, value.c_str());
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 3403745..1be680a 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -8,6 +8,7 @@
#include <cmext/string_view>
#include "cmGlobalGenerator.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -390,7 +391,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const
}
static std::string output;
- output = cmJoin(this->IncludeDirectories, ";");
+ output = cmList::to_string(this->IncludeDirectories);
return cmValue(output);
}
@@ -400,7 +401,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const
}
static std::string output;
- output = cmJoin(this->CompileOptions, ";");
+ output = cmList::to_string(this->CompileOptions);
return cmValue(output);
}
@@ -410,7 +411,7 @@ cmValue cmSourceFile::GetProperty(const std::string& prop) const
}
static std::string output;
- output = cmJoin(this->CompileDefinitions, ";");
+ output = cmList::to_string(this->CompileDefinitions);
return cmValue(output);
}
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index bb75a14..4b1685f 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -4,6 +4,7 @@
#include <cstddef>
#include <map>
+#include <memory>
#include <set>
#include <utility>
@@ -11,6 +12,8 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSourceFileLocation.h"
#include "cmSourceGroup.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -194,7 +197,10 @@ bool cmSourceGroupCommand(std::vector<std::string> const& args,
// If only two arguments are given, the pre-1.8 version of the
// command is being invoked.
- if (args.size() == 2 && args[1] != "FILES") {
+ bool isShortTreeSyntax =
+ ((args.size() == 2) && (args[0] == kTreeOptionName) &&
+ cmSystemTools::FileIsDirectory(args[1]));
+ if (args.size() == 2 && args[1] != kFilesOptionName && !isShortTreeSyntax) {
cmSourceGroup* sg = mf.GetOrCreateSourceGroup(args[0]);
if (!sg) {
@@ -274,8 +280,19 @@ static bool processTree(cmMakefile& mf, ParsedArguments& parsedArguments,
? ""
: parsedArguments[kPrefixOptionName].front();
- const std::vector<std::string> filesVector = prepareFilesPathsForTree(
- parsedArguments[kFilesOptionName], mf.GetCurrentSourceDirectory());
+ std::vector<std::string> files = parsedArguments[kFilesOptionName];
+ if (files.empty()) {
+ const std::vector<std::unique_ptr<cmSourceFile>>& srcFiles =
+ mf.GetSourceFiles();
+ for (const auto& srcFile : srcFiles) {
+ if (!srcFile->GetIsGenerated()) {
+ files.push_back(srcFile->GetLocation().GetFullPath());
+ }
+ }
+ }
+
+ const std::vector<std::string> filesVector =
+ prepareFilesPathsForTree(files, mf.GetCurrentSourceDirectory());
if (!rootIsPrefix(root, filesVector, errorMsg)) {
return false;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 2596d8c..d41e8e5 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -17,6 +17,7 @@
#include "cmDefinitions.h"
#include "cmExecutionStatus.h"
#include "cmGlobVerificationManager.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -584,10 +585,10 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
{
if (prop == "CACHE_VARIABLES") {
std::vector<std::string> cacheKeys = this->GetCacheEntryKeys();
- this->SetGlobalProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";"));
+ this->SetGlobalProperty("CACHE_VARIABLES", cmList::to_string(cacheKeys));
} else if (prop == "COMMANDS") {
std::vector<std::string> commands = this->GetCommandNames();
- this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";"));
+ this->SetGlobalProperty("COMMANDS", cmList::to_string(commands));
} else if (prop == "IN_TRY_COMPILE") {
this->SetGlobalProperty(
"IN_TRY_COMPILE",
@@ -596,8 +597,7 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
this->SetGlobalProperty("GENERATOR_IS_MULTI_CONFIG",
this->IsGeneratorMultiConfig ? "1" : "0");
} else if (prop == "ENABLED_LANGUAGES") {
- std::string langs;
- langs = cmJoin(this->EnabledLanguages, ";");
+ auto langs = cmList::to_string(this->EnabledLanguages);
this->SetGlobalProperty("ENABLED_LANGUAGES", langs);
} else if (prop == "CMAKE_ROLE") {
std::string mode = this->GetModeString();
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 6e6fcbd..39353f3 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -13,6 +13,7 @@
#include <cmext/string_view>
#include "cmAlgorithms.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmProperty.h"
#include "cmPropertyMap.h"
@@ -20,7 +21,6 @@
#include "cmState.h"
#include "cmStatePrivate.h"
#include "cmStateTypes.h"
-#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -381,15 +381,15 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop,
for (cmStateSnapshot const& ci : children) {
child_dirs.push_back(ci.GetDirectory().GetCurrentSource());
}
- output = cmJoin(child_dirs, ";");
+ output = cmList::to_string(child_dirs);
return cmValue(output);
}
if (prop == kBUILDSYSTEM_TARGETS) {
- output = cmJoin(this->DirectoryState->NormalTargetNames, ";");
+ output = cmList::to_string(this->DirectoryState->NormalTargetNames);
return cmValue(output);
}
if (prop == "IMPORTED_TARGETS"_s) {
- output = cmJoin(this->DirectoryState->ImportedTargetNames, ";");
+ output = cmList::to_string(this->DirectoryState->ImportedTargetNames);
return cmValue(output);
}
@@ -401,38 +401,38 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop,
snp = snp.GetCallStackParent();
}
std::reverse(listFiles.begin(), listFiles.end());
- output = cmJoin(listFiles, ";");
+ output = cmList::to_string(listFiles);
return cmValue(output);
}
if (prop == "CACHE_VARIABLES") {
- output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";");
+ output = cmList::to_string(this->Snapshot_.State->GetCacheEntryKeys());
return cmValue(output);
}
if (prop == "VARIABLES") {
std::vector<std::string> res = this->Snapshot_.ClosureKeys();
cm::append(res, this->Snapshot_.State->GetCacheEntryKeys());
std::sort(res.begin(), res.end());
- output = cmJoin(res, ";");
+ output = cmList::to_string(res);
return cmValue(output);
}
if (prop == "INCLUDE_DIRECTORIES") {
- output = cmJoin(this->GetIncludeDirectoriesEntries(), ";");
+ output = cmList::to_string(this->GetIncludeDirectoriesEntries());
return cmValue(output);
}
if (prop == "COMPILE_OPTIONS") {
- output = cmJoin(this->GetCompileOptionsEntries(), ";");
+ output = cmList::to_string(this->GetCompileOptionsEntries());
return cmValue(output);
}
if (prop == "COMPILE_DEFINITIONS") {
- output = cmJoin(this->GetCompileDefinitionsEntries(), ";");
+ output = cmList::to_string(this->GetCompileDefinitionsEntries());
return cmValue(output);
}
if (prop == "LINK_OPTIONS") {
- output = cmJoin(this->GetLinkOptionsEntries(), ";");
+ output = cmList::to_string(this->GetLinkOptionsEntries());
return cmValue(output);
}
if (prop == "LINK_DIRECTORIES") {
- output = cmJoin(this->GetLinkDirectoriesEntries(), ";");
+ output = cmList::to_string(this->GetLinkDirectoriesEntries());
return cmValue(output);
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 81497f5..15f45f5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -811,12 +811,12 @@ std::pair<bool, cmValue> FileSetType::ReadProperties(
did_read = true;
} else if (prop == this->SelfEntries.PropertyName) {
static std::string output;
- output = cmJoin(this->SelfEntries.Entries, ";"_s);
+ output = cmList::to_string(this->SelfEntries.Entries);
value = cmValue(output);
did_read = true;
} else if (prop == this->InterfaceEntries.PropertyName) {
static std::string output;
- output = cmJoin(this->InterfaceEntries.Entries, ";"_s);
+ output = cmList::to_string(this->InterfaceEntries.Entries);
value = cmValue(output);
did_read = true;
} else if (cmHasPrefix(prop, this->DirectoryPrefix)) {
@@ -899,7 +899,7 @@ std::pair<bool, cmValue> UsageRequirementProperty::Read(
if (!this->Entries.empty()) {
// Storage to back the returned `cmValue`.
static std::string output;
- output = cmJoin(this->Entries, ";");
+ output = cmList::to_string(this->Entries);
value = cmValue(output);
}
did_read = true;
@@ -2130,7 +2130,7 @@ cmValue cmTargetInternals::GetFileSetDirectories(
return nullptr;
}
static std::string output;
- output = cmJoin(fileSet->GetDirectoryEntries(), ";"_s);
+ output = cmList::to_string(fileSet->GetDirectoryEntries());
return cmValue(output);
}
@@ -2150,7 +2150,7 @@ cmValue cmTargetInternals::GetFileSetPaths(cmTarget const* self,
return nullptr;
}
static std::string output;
- output = cmJoin(fileSet->GetFileEntries(), ";"_s);
+ output = cmList::to_string(fileSet->GetFileEntries());
return cmValue(output);
}
@@ -2495,7 +2495,7 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
[](const BT<std::pair<std::string, bool>>& item) -> std::string {
return item.Value.first;
});
- output = cmJoin(utilities, ";");
+ output = cmList::to_string(utilities);
return cmValue(output);
}
if (prop == propIMPORTED) {
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index aa1abdd..37c125b 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileFeaturesCommand.h"
+#include "cmList.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStandardLevelResolver.h"
@@ -43,7 +44,7 @@ private:
std::string Join(const std::vector<std::string>& content) override
{
- return cmJoin(content, ";");
+ return cmList::to_string(content);
}
};
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 8ca3842..e73a75f 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileOptionsCommand.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -44,7 +45,7 @@ private:
std::string Join(const std::vector<std::string>& content) override
{
- return cmJoin(content, ";");
+ return cmList::to_string(content);
}
};
diff --git a/Source/cmTargetLinkDirectoriesCommand.cxx b/Source/cmTargetLinkDirectoriesCommand.cxx
index 3ba27a8..dddb348 100644
--- a/Source/cmTargetLinkDirectoriesCommand.cxx
+++ b/Source/cmTargetLinkDirectoriesCommand.cxx
@@ -3,6 +3,7 @@
#include "cmTargetLinkDirectoriesCommand.h"
#include "cmGeneratorExpression.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -58,7 +59,7 @@ std::string TargetLinkDirectoriesImpl::Join(
directories.push_back(unixPath);
}
- return cmJoin(directories, ";");
+ return cmList::to_string(directories);
}
} // namespace
diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx
index 3ea2d71..cd93835 100644
--- a/Source/cmTargetLinkOptionsCommand.cxx
+++ b/Source/cmTargetLinkOptionsCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetLinkOptionsCommand.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -36,7 +37,7 @@ private:
std::string Join(const std::vector<std::string>& content) override
{
- return cmJoin(content, ";");
+ return cmList::to_string(content);
}
};
diff --git a/Source/cmTargetPrecompileHeadersCommand.cxx b/Source/cmTargetPrecompileHeadersCommand.cxx
index 4dd158d..0173a92 100644
--- a/Source/cmTargetPrecompileHeadersCommand.cxx
+++ b/Source/cmTargetPrecompileHeadersCommand.cxx
@@ -5,6 +5,7 @@
#include <utility>
#include "cmGeneratorExpression.h"
+#include "cmList.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -73,7 +74,7 @@ private:
std::string Join(const std::vector<std::string>& content) override
{
- return cmJoin(content, ";");
+ return cmList::to_string(content);
}
};
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index 12328b1..3d484f5 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -98,7 +98,7 @@ private:
std::string Join(const std::vector<std::string>& content) override
{
- return cmJoin(content, ";");
+ return cmList::to_string(content);
}
enum class IsInterface
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index ed5f38b..3de7ae5 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -5,11 +5,9 @@
#include "cmUVProcessChain.h"
#include <array>
-#include <cassert>
#include <csignal>
#include <cstdio>
#include <istream> // IWYU pragma: keep
-#include <iterator>
#include <type_traits>
#include <utility>
@@ -19,43 +17,24 @@
#include "cmGetPipes.h"
#include "cmUVHandlePtr.h"
-#include "cmUVStreambuf.h"
struct cmUVProcessChain::InternalData
{
- struct BasicStreamData
+ struct StreamData
{
- cmUVStreambuf Streambuf;
- cm::uv_pipe_ptr BuiltinStream;
+ int BuiltinStream = -1;
uv_stdio_container_t Stdio;
};
- template <typename IOStream>
- struct StreamData : public BasicStreamData
- {
- StreamData()
- : BuiltinIOStream(&this->Streambuf)
- {
- }
-
- IOStream BuiltinIOStream;
-
- IOStream* GetBuiltinStream()
- {
- if (this->BuiltinStream.get()) {
- return &this->BuiltinIOStream;
- }
- return nullptr;
- }
- };
-
struct ProcessData
{
cmUVProcessChain::InternalData* Data;
cm::uv_process_ptr Process;
+ cm::uv_pipe_ptr InputPipe;
cm::uv_pipe_ptr OutputPipe;
- bool Finished = false;
Status ProcessStatus;
+
+ void Finish();
};
const cmUVProcessChainBuilder* Builder = nullptr;
@@ -64,18 +43,21 @@ struct cmUVProcessChain::InternalData
cm::uv_loop_ptr Loop;
- StreamData<std::istream> OutputStreamData;
- StreamData<std::istream> ErrorStreamData;
+ StreamData InputStreamData;
+ StreamData OutputStreamData;
+ StreamData ErrorStreamData;
+ cm::uv_pipe_ptr TempOutputPipe;
+ cm::uv_pipe_ptr TempErrorPipe;
unsigned int ProcessesCompleted = 0;
std::vector<std::unique_ptr<ProcessData>> Processes;
bool Prepare(const cmUVProcessChainBuilder* builder);
- bool AddCommand(const cmUVProcessChainBuilder::ProcessConfiguration& config,
- bool first, bool last);
- bool Finish();
-
- static const Status* GetStatus(const ProcessData& data);
+ void SpawnProcess(
+ std::size_t index,
+ const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first,
+ bool last);
+ void Finish();
};
cmUVProcessChainBuilder::cmUVProcessChainBuilder()
@@ -132,9 +114,6 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream(
{
switch (stdio) {
case Stream_INPUT:
- // FIXME
- break;
-
case Stream_OUTPUT:
case Stream_ERROR: {
auto& streamData = this->Stdio[stdio];
@@ -167,11 +146,9 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const
return chain;
}
- for (auto it = this->Processes.begin(); it != this->Processes.end(); ++it) {
- if (!chain.Data->AddCommand(*it, it == this->Processes.begin(),
- it == std::prev(this->Processes.end()))) {
- return chain;
- }
+ for (std::size_t i = 0; i < this->Processes.size(); i++) {
+ chain.Data->SpawnProcess(i, this->Processes[i], i == 0,
+ i == this->Processes.size() - 1);
}
chain.Data->Finish();
@@ -179,20 +156,30 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const
return chain;
}
-const cmUVProcessChain::Status* cmUVProcessChain::InternalData::GetStatus(
- const cmUVProcessChain::InternalData::ProcessData& data)
-{
- if (data.Finished) {
- return &data.ProcessStatus;
- }
- return nullptr;
-}
-
bool cmUVProcessChain::InternalData::Prepare(
const cmUVProcessChainBuilder* builder)
{
this->Builder = builder;
+ auto const& input =
+ this->Builder->Stdio[cmUVProcessChainBuilder::Stream_INPUT];
+ auto& inputData = this->InputStreamData;
+ switch (input.Type) {
+ case cmUVProcessChainBuilder::None:
+ inputData.Stdio.flags = UV_IGNORE;
+ break;
+
+ case cmUVProcessChainBuilder::Builtin: {
+ // FIXME
+ break;
+ }
+
+ case cmUVProcessChainBuilder::External:
+ inputData.Stdio.flags = UV_INHERIT_FD;
+ inputData.Stdio.data.fd = input.FileDescriptor;
+ break;
+ }
+
auto const& error =
this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR];
auto& errorData = this->ErrorStreamData;
@@ -207,12 +194,17 @@ bool cmUVProcessChain::InternalData::Prepare(
return false;
}
- errorData.BuiltinStream.init(*this->Loop, 0);
- if (uv_pipe_open(errorData.BuiltinStream, pipeFd[0]) < 0) {
- return false;
- }
+ errorData.BuiltinStream = pipeFd[0];
errorData.Stdio.flags = UV_INHERIT_FD;
errorData.Stdio.data.fd = pipeFd[1];
+
+ if (this->TempErrorPipe.init(*this->Loop, 0) < 0) {
+ return false;
+ }
+ if (uv_pipe_open(this->TempErrorPipe, errorData.Stdio.data.fd) < 0) {
+ return false;
+ }
+
break;
}
@@ -232,13 +224,25 @@ bool cmUVProcessChain::InternalData::Prepare(
case cmUVProcessChainBuilder::Builtin:
if (this->Builder->MergedBuiltinStreams) {
+ outputData.BuiltinStream = errorData.BuiltinStream;
outputData.Stdio.flags = UV_INHERIT_FD;
outputData.Stdio.data.fd = errorData.Stdio.data.fd;
} else {
- outputData.BuiltinStream.init(*this->Loop, 0);
- outputData.Stdio.flags =
- static_cast<uv_stdio_flags>(UV_CREATE_PIPE | UV_WRITABLE_PIPE);
- outputData.Stdio.data.stream = outputData.BuiltinStream;
+ int pipeFd[2];
+ if (cmGetPipes(pipeFd) < 0) {
+ return false;
+ }
+
+ outputData.BuiltinStream = pipeFd[0];
+ outputData.Stdio.flags = UV_INHERIT_FD;
+ outputData.Stdio.data.fd = pipeFd[1];
+
+ if (this->TempOutputPipe.init(*this->Loop, 0) < 0) {
+ return false;
+ }
+ if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) {
+ return false;
+ }
}
break;
@@ -248,16 +252,47 @@ bool cmUVProcessChain::InternalData::Prepare(
break;
}
+ bool first = true;
+ for (std::size_t i = 0; i < this->Builder->Processes.size(); i++) {
+ this->Processes.emplace_back(cm::make_unique<ProcessData>());
+ auto& process = *this->Processes.back();
+ process.Data = this;
+ process.ProcessStatus.Finished = false;
+
+ if (!first) {
+ auto& prevProcess = *this->Processes[i - 1];
+
+ int pipeFd[2];
+ if (cmGetPipes(pipeFd) < 0) {
+ return false;
+ }
+
+ if (prevProcess.OutputPipe.init(*this->Loop, 0) < 0) {
+ return false;
+ }
+ if (uv_pipe_open(prevProcess.OutputPipe, pipeFd[1]) < 0) {
+ return false;
+ }
+ if (process.InputPipe.init(*this->Loop, 0) < 0) {
+ return false;
+ }
+ if (uv_pipe_open(process.InputPipe, pipeFd[0]) < 0) {
+ return false;
+ }
+ }
+
+ first = false;
+ }
+
return true;
}
-bool cmUVProcessChain::InternalData::AddCommand(
+void cmUVProcessChain::InternalData::SpawnProcess(
+ std::size_t index,
const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first,
bool last)
{
- this->Processes.emplace_back(cm::make_unique<ProcessData>());
- auto& process = *this->Processes.back();
- process.Data = this;
+ auto& process = *this->Processes[index];
auto options = uv_process_options_t();
@@ -277,24 +312,18 @@ bool cmUVProcessChain::InternalData::AddCommand(
}
std::array<uv_stdio_container_t, 3> stdio;
- stdio[0] = uv_stdio_container_t();
if (first) {
- stdio[0].flags = UV_IGNORE;
+ stdio[0] = this->InputStreamData.Stdio;
} else {
- assert(this->Processes.size() >= 2);
- auto& prev = *this->Processes[this->Processes.size() - 2];
+ stdio[0] = uv_stdio_container_t();
stdio[0].flags = UV_INHERIT_STREAM;
- stdio[0].data.stream = prev.OutputPipe;
+ stdio[0].data.stream = process.InputPipe;
}
if (last) {
stdio[1] = this->OutputStreamData.Stdio;
} else {
- if (process.OutputPipe.init(*this->Loop, 0) < 0) {
- return false;
- }
stdio[1] = uv_stdio_container_t();
- stdio[1].flags =
- static_cast<uv_stdio_flags>(UV_CREATE_PIPE | UV_WRITABLE_PIPE);
+ stdio[1].flags = UV_INHERIT_STREAM;
stdio[1].data.stream = process.OutputPipe;
}
stdio[2] = this->ErrorStreamData.Stdio;
@@ -304,40 +333,24 @@ bool cmUVProcessChain::InternalData::AddCommand(
options.exit_cb = [](uv_process_t* handle, int64_t exitStatus,
int termSignal) {
auto* processData = static_cast<ProcessData*>(handle->data);
- processData->Finished = true;
processData->ProcessStatus.ExitStatus = exitStatus;
processData->ProcessStatus.TermSignal = termSignal;
- processData->Data->ProcessesCompleted++;
+ processData->Finish();
};
- return process.Process.spawn(*this->Loop, options, &process) >= 0;
+ if ((process.ProcessStatus.SpawnResult =
+ process.Process.spawn(*this->Loop, options, &process)) < 0) {
+ process.Finish();
+ }
+ process.InputPipe.reset();
+ process.OutputPipe.reset();
}
-bool cmUVProcessChain::InternalData::Finish()
+void cmUVProcessChain::InternalData::Finish()
{
- if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_OUTPUT].Type ==
- cmUVProcessChainBuilder::Builtin &&
- !this->Builder->MergedBuiltinStreams) {
- this->OutputStreamData.Streambuf.open(
- this->OutputStreamData.BuiltinStream);
- }
-
- if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR].Type ==
- cmUVProcessChainBuilder::Builtin) {
- cm::uv_pipe_ptr tmpPipe;
- if (tmpPipe.init(*this->Loop, 0) < 0) {
- return false;
- }
- if (uv_pipe_open(tmpPipe, this->ErrorStreamData.Stdio.data.fd) < 0) {
- return false;
- }
- tmpPipe.reset();
-
- this->ErrorStreamData.Streambuf.open(this->ErrorStreamData.BuiltinStream);
- }
-
+ this->TempOutputPipe.reset();
+ this->TempErrorPipe.reset();
this->Valid = true;
- return true;
}
cmUVProcessChain::cmUVProcessChain()
@@ -365,17 +378,14 @@ uv_loop_t& cmUVProcessChain::GetLoop()
return *this->Data->Loop;
}
-std::istream* cmUVProcessChain::OutputStream()
+int cmUVProcessChain::OutputStream()
{
- if (this->Data->Builder->MergedBuiltinStreams) {
- return this->Data->ErrorStreamData.GetBuiltinStream();
- }
- return this->Data->OutputStreamData.GetBuiltinStream();
+ return this->Data->OutputStreamData.BuiltinStream;
}
-std::istream* cmUVProcessChain::ErrorStream()
+int cmUVProcessChain::ErrorStream()
{
- return this->Data->ErrorStreamData.GetBuiltinStream();
+ return this->Data->ErrorStreamData.BuiltinStream;
}
bool cmUVProcessChain::Valid() const
@@ -412,19 +422,15 @@ std::vector<const cmUVProcessChain::Status*> cmUVProcessChain::GetStatus()
std::vector<const cmUVProcessChain::Status*> statuses(
this->Data->Processes.size(), nullptr);
for (std::size_t i = 0; i < statuses.size(); i++) {
- statuses[i] = this->GetStatus(i);
+ statuses[i] = &this->GetStatus(i);
}
return statuses;
}
-const cmUVProcessChain::Status* cmUVProcessChain::GetStatus(
+const cmUVProcessChain::Status& cmUVProcessChain::GetStatus(
std::size_t index) const
{
- auto const& process = *this->Data->Processes[index];
- if (process.Finished) {
- return &process.ProcessStatus;
- }
- return nullptr;
+ return this->Data->Processes[index]->ProcessStatus;
}
bool cmUVProcessChain::Finished() const
@@ -435,8 +441,12 @@ bool cmUVProcessChain::Finished() const
std::pair<cmUVProcessChain::ExceptionCode, std::string>
cmUVProcessChain::Status::GetException() const
{
+ if (this->SpawnResult) {
+ return std::make_pair(ExceptionCode::Spawn,
+ uv_strerror(this->SpawnResult));
+ }
#ifdef _WIN32
- if ((this->ExitStatus & 0xF0000000) == 0xC0000000) {
+ if (this->Finished && (this->ExitStatus & 0xF0000000) == 0xC0000000) {
// Child terminated due to exceptional behavior.
switch (this->ExitStatus) {
case STATUS_CONTROL_C_EXIT:
@@ -511,9 +521,8 @@ cmUVProcessChain::Status::GetException() const
}
}
}
- return std::make_pair(ExceptionCode::None, "");
#else
- if (this->TermSignal) {
+ if (this->Finished && this->TermSignal) {
switch (this->TermSignal) {
# ifdef SIGSEGV
case SIGSEGV:
@@ -670,6 +679,12 @@ cmUVProcessChain::Status::GetException() const
}
}
}
- return std::make_pair(ExceptionCode::None, "");
#endif
+ return std::make_pair(ExceptionCode::None, "");
+}
+
+void cmUVProcessChain::InternalData::ProcessData::Finish()
+{
+ this->ProcessStatus.Finished = true;
+ this->Data->ProcessesCompleted++;
}
diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h
index f92742f..d7a4a0e 100644
--- a/Source/cmUVProcessChain.h
+++ b/Source/cmUVProcessChain.h
@@ -5,7 +5,6 @@
#include <array>
#include <cstddef> // IWYU pragma: keep
#include <cstdint>
-#include <iosfwd>
#include <memory>
#include <string>
#include <utility>
@@ -74,11 +73,14 @@ public:
Illegal,
Interrupt,
Numerical,
+ Spawn,
Other,
};
struct Status
{
+ int SpawnResult;
+ bool Finished;
int64_t ExitStatus;
int TermSignal;
@@ -96,13 +98,13 @@ public:
uv_loop_t& GetLoop();
// FIXME: Add stdin support
- std::istream* OutputStream();
- std::istream* ErrorStream();
+ int OutputStream();
+ int ErrorStream();
bool Valid() const;
bool Wait(int64_t milliseconds = -1);
std::vector<const Status*> GetStatus() const;
- const Status* GetStatus(std::size_t index) const;
+ const Status& GetStatus(std::size_t index) const;
bool Finished() const;
private:
diff --git a/Source/cmUVStream.h b/Source/cmUVStream.h
new file mode 100644
index 0000000..5998256
--- /dev/null
+++ b/Source/cmUVStream.h
@@ -0,0 +1,140 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include <cassert>
+#include <istream>
+
+#include <cm3p/uv.h>
+
+#include "cmUVHandlePtr.h"
+#include "cmUVStreambuf.h"
+
+template <typename CharT, typename Traits = std::char_traits<CharT>>
+class cmBasicUVIStream : public std::basic_istream<CharT>
+{
+public:
+ cmBasicUVIStream();
+ cmBasicUVIStream(uv_stream_t* stream);
+
+ bool is_open() const;
+
+ void open(uv_stream_t* stream);
+
+ void close();
+
+private:
+ cmBasicUVStreambuf<CharT, Traits> Buffer;
+};
+
+template <typename CharT, typename Traits>
+cmBasicUVIStream<CharT, Traits>::cmBasicUVIStream()
+ : std::basic_istream<CharT, Traits>(&this->Buffer)
+{
+}
+
+template <typename CharT, typename Traits>
+cmBasicUVIStream<CharT, Traits>::cmBasicUVIStream(uv_stream_t* stream)
+ : cmBasicUVIStream()
+{
+ this->open(stream);
+}
+
+template <typename CharT, typename Traits>
+bool cmBasicUVIStream<CharT, Traits>::is_open() const
+{
+ return this->Buffer.is_open();
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVIStream<CharT, Traits>::open(uv_stream_t* stream)
+{
+ this->Buffer.open(stream);
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVIStream<CharT, Traits>::close()
+{
+ this->Buffer.close();
+}
+
+using cmUVIStream = cmBasicUVIStream<char>;
+
+template <typename CharT, typename Traits = std::char_traits<CharT>>
+class cmBasicUVPipeIStream : public cmBasicUVIStream<CharT, Traits>
+{
+public:
+ cmBasicUVPipeIStream();
+ cmBasicUVPipeIStream(uv_loop_t& loop, int fd);
+
+ using cmBasicUVIStream<CharT, Traits>::is_open;
+
+ void open(uv_loop_t& loop, int fd);
+
+ void close();
+
+private:
+ cm::uv_pipe_ptr Pipe;
+};
+
+template <typename CharT, typename Traits>
+cmBasicUVPipeIStream<CharT, Traits>::cmBasicUVPipeIStream() = default;
+
+template <typename CharT, typename Traits>
+cmBasicUVPipeIStream<CharT, Traits>::cmBasicUVPipeIStream(uv_loop_t& loop,
+ int fd)
+{
+ this->open(loop, fd);
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVPipeIStream<CharT, Traits>::open(uv_loop_t& loop, int fd)
+{
+ this->Pipe.init(loop, 0);
+ uv_pipe_open(this->Pipe, fd);
+ this->cmBasicUVIStream<CharT, Traits>::open(this->Pipe);
+}
+
+template <typename CharT, typename Traits>
+void cmBasicUVPipeIStream<CharT, Traits>::close()
+{
+ this->cmBasicUVIStream<CharT, Traits>::close();
+ this->Pipe.reset();
+}
+
+using cmUVPipeIStream = cmBasicUVPipeIStream<char>;
+
+template <typename ReadCallback, typename FinishCallback>
+void cmUVStreamRead(uv_stream_t* stream, ReadCallback onRead,
+ FinishCallback onFinish)
+{
+ struct ReadData
+ {
+ std::vector<char> Buffer;
+ ReadCallback OnRead;
+ FinishCallback OnFinish;
+ };
+
+ stream->data = new ReadData{ {}, std::move(onRead), std::move(onFinish) };
+ uv_read_start(
+ stream,
+ [](uv_handle_t* s, std::size_t suggestedSize, uv_buf_t* buffer) {
+ auto* data = static_cast<ReadData*>(s->data);
+ data->Buffer.resize(suggestedSize);
+ buffer->base = data->Buffer.data();
+ buffer->len = suggestedSize;
+ },
+ [](uv_stream_t* s, ssize_t nread, const uv_buf_t* buffer) {
+ auto* data = static_cast<ReadData*>(s->data);
+ if (nread > 0) {
+ (void)buffer;
+ assert(buffer->base == data->Buffer.data());
+ data->Buffer.resize(nread);
+ data->OnRead(std::move(data->Buffer));
+ } else if (nread < 0 /*|| nread == UV_EOF*/) {
+ data->OnFinish();
+ uv_read_stop(s);
+ delete data;
+ }
+ });
+}
diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h
index efe45de..4f7b209 100644
--- a/Source/cmUVStreambuf.h
+++ b/Source/cmUVStreambuf.h
@@ -14,7 +14,8 @@
/*
* This file is based on example code from:
*
- * http://www.voidcn.com/article/p-vjnlygmc-gy.html
+ * https://web.archive.org/web/20170515211805/
+ * http://www.mr-edd.co.uk/blog/beginners_guide_streambuf
*
* The example code was distributed under the following license:
*
diff --git a/Source/cmUuid.cxx b/Source/cmUuid.cxx
index 6688668..5f5d3e4 100644
--- a/Source/cmUuid.cxx
+++ b/Source/cmUuid.cxx
@@ -104,20 +104,20 @@ std::string cmUuid::BinaryToString(const unsigned char* input) const
size_t bytes = kUuidGroups[i];
for (size_t j = 0; j < bytes; ++j) {
- unsigned char byte = input[inputIndex++];
- output += this->ByteToHex(byte);
+ unsigned char inputByte = input[inputIndex++];
+ output += this->ByteToHex(inputByte);
}
}
return output;
}
-std::string cmUuid::ByteToHex(unsigned char byte) const
+std::string cmUuid::ByteToHex(unsigned char inputByte) const
{
std::string result(" ");
for (int i = 0; i < 2; ++i) {
- unsigned char rest = byte % 16;
- byte /= 16;
+ unsigned char rest = inputByte % 16;
+ inputByte /= 16;
char c = (rest < 0xA) ? static_cast<char>('0' + rest)
: static_cast<char>('a' + (rest - 0xA));
result.at(1 - i) = c;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8d6b024..4af3ebc 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2534,18 +2534,6 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
break;
case cmGeneratorTarget::SourceKindExternalObject:
tool = "Object";
- if (this->LocalGenerator->GetVersion() <
- cmGlobalVisualStudioGenerator::VSVersion::VS11) {
- // For VS == 10 we cannot use LinkObjects to avoid linking custom
- // command outputs. If an object file is generated in this target,
- // then vs10 will use it in the build, and we have to list it as
- // None instead of Object.
- std::vector<cmSourceFile*> const* d =
- this->GeneratorTarget->GetSourceDepends(si.Source);
- if (d && !d->empty()) {
- tool = "None";
- }
- }
break;
case cmGeneratorTarget::SourceKindExtra:
this->WriteExtraSource(e1, si.Source, toolSettings);
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 6e98874..7e4503b 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -75,7 +75,6 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
// the flag to disable exception handling. When the user does
// remove the flag we need to override the IDE default of on.
switch (this->Version) {
- case cmGlobalVisualStudioGenerator::VSVersion::VS11:
case cmGlobalVisualStudioGenerator::VSVersion::VS12:
case cmGlobalVisualStudioGenerator::VSVersion::VS14:
case cmGlobalVisualStudioGenerator::VSVersion::VS15:
diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx
index 12877b8..7b3349b 100644
--- a/Source/cm_codecvt.cxx
+++ b/Source/cm_codecvt.cxx
@@ -13,19 +13,19 @@
# include "cm_utf8.h"
#endif
-codecvt::codecvt(Encoding e)
+codecvt::codecvt(codecvt_Encoding e)
#if defined(_WIN32)
: m_codepage(0)
#endif
{
switch (e) {
- case codecvt::ConsoleOutput:
+ case codecvt_Encoding::ConsoleOutput:
#if defined(_WIN32)
m_noconv = false;
m_codepage = GetConsoleOutputCP();
break;
#endif
- case codecvt::ANSI:
+ case codecvt_Encoding::ANSI:
#if defined(_WIN32)
m_noconv = false;
m_codepage = CP_ACP;
@@ -33,10 +33,10 @@ codecvt::codecvt(Encoding e)
#endif
// We don't know which ANSI encoding to use for other platforms than
// Windows so we don't do any conversion there
- case codecvt::UTF8:
- case codecvt::UTF8_WITH_BOM:
+ case codecvt_Encoding::UTF8:
+ case codecvt_Encoding::UTF8_WITH_BOM:
// Assume internal encoding is UTF-8
- case codecvt::None:
+ case codecvt_Encoding::None:
// No encoding
default:
this->m_noconv = true;
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index f628de7..eb98e98 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -7,21 +7,14 @@
#include <cwchar>
#include <locale>
+#include "cm_codecvt_Encoding.hxx"
+
class codecvt : public std::codecvt<char, char, mbstate_t>
{
public:
- enum Encoding
- {
- None,
- UTF8,
- UTF8_WITH_BOM,
- ANSI,
- ConsoleOutput,
- };
-
#ifndef CMAKE_BOOTSTRAP
- codecvt(Encoding e);
+ codecvt(codecvt_Encoding e);
protected:
~codecvt() override;
diff --git a/Source/cm_codecvt_Encoding.hxx b/Source/cm_codecvt_Encoding.hxx
new file mode 100644
index 0000000..b91ad8f
--- /dev/null
+++ b/Source/cm_codecvt_Encoding.hxx
@@ -0,0 +1,12 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+enum class codecvt_Encoding
+{
+ None,
+ UTF8,
+ UTF8_WITH_BOM,
+ ANSI,
+ ConsoleOutput,
+};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f30d4d3..b8ebca5 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -94,7 +94,6 @@
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalJOMMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
-# include "cmGlobalVisualStudio11Generator.h"
# include "cmGlobalVisualStudio12Generator.h"
# include "cmGlobalVisualStudio14Generator.h"
# include "cmGlobalVisualStudio9Generator.h"
@@ -2507,6 +2506,18 @@ int cmake::ActualConfigure()
"Name of generator toolset.", cmStateEnums::INTERNAL);
}
+ if (!this->State->GetInitializedCacheValue(
+ "CMAKE_CROSSCOMPILING_EMULATOR")) {
+ cm::optional<std::string> emulator =
+ cmSystemTools::GetEnvVar("CMAKE_CROSSCOMPILING_EMULATOR");
+ if (emulator && !emulator->empty()) {
+ std::string message =
+ "Emulator to run executables and tests when cross compiling.";
+ this->AddCacheEntry("CMAKE_CROSSCOMPILING_EMULATOR", *emulator, message,
+ cmStateEnums::STRING);
+ }
+ }
+
// reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time
@@ -2605,7 +2616,6 @@ std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator()
static VSVersionedGenerator const vsGenerators[] = {
{ "14.0", "Visual Studio 14 2015" }, //
{ "12.0", "Visual Studio 12 2013" }, //
- { "11.0", "Visual Studio 11 2012" }, //
{ "9.0", "Visual Studio 9 2008" }
};
static const char* const vsEntries[] = {
@@ -2990,7 +3000,6 @@ void cmake::AddDefaultGenerators()
cmGlobalVisualStudioVersionedGenerator::NewFactory15());
this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory());
this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory());
- this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory());
this->Generators.push_back(cmGlobalVisualStudio9Generator::NewFactory());
this->Generators.push_back(cmGlobalBorlandMakefileGenerator::NewFactory());
this->Generators.push_back(cmGlobalNMakeMakefileGenerator::NewFactory());
@@ -3916,7 +3925,7 @@ std::function<int()> cmake::BuildWorkflowStep(
return [builder]() -> int {
auto chain = builder.Start();
chain.Wait();
- return static_cast<int>(chain.GetStatus().front()->ExitStatus);
+ return static_cast<int>(chain.GetStatus(0).ExitStatus);
};
}
#endif
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 0c8d8db..ce2479b 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -28,6 +28,7 @@
#include "cmSystemTools.h"
#include "cmTransformDepfile.h"
#include "cmUVProcessChain.h"
+#include "cmUVStream.h"
#include "cmUtils.hxx"
#include "cmValue.h"
#include "cmVersion.h"
@@ -2008,7 +2009,7 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command,
.SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR)
.AddCommand(command);
auto process = builder.Start();
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::cerr << "Failed to start preprocessor.";
return 1;
}
@@ -2016,12 +2017,9 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command,
std::cerr << "Failed to wait for preprocessor";
return 1;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
- auto* errorStream = process.ErrorStream();
- if (errorStream) {
- std::cerr << errorStream->rdbuf();
- }
+ if (process.GetStatus(0).ExitStatus != 0) {
+ cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream());
+ std::cerr << errorStream.rdbuf();
return 1;
}
@@ -2130,7 +2128,7 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
.AddCommand(resource_compile);
auto process = builder.Start();
result = 0;
- if (!process.Valid()) {
+ if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
std::cerr << "Failed to start resource compiler.";
result = 1;
} else {
@@ -2144,12 +2142,9 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
if (result != 0) {
return result;
}
- auto status = process.GetStatus();
- if (!status[0] || status[0]->ExitStatus != 0) {
- auto* errorStream = process.ErrorStream();
- if (errorStream) {
- std::cerr << errorStream->rdbuf();
- }
+ if (process.GetStatus(0).ExitStatus != 0) {
+ cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream());
+ std::cerr << errorStream.rdbuf();
return 1;
}