summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx2
-rw-r--r--Source/cmAddCompileDefinitionsCommand.cxx14
-rw-r--r--Source/cmAddCompileDefinitionsCommand.h24
-rw-r--r--Source/cmAddCompileOptionsCommand.cxx14
-rw-r--r--Source/cmAddCompileOptionsCommand.h24
-rw-r--r--Source/cmAddCustomCommandCommand.cxx84
-rw-r--r--Source/cmAddCustomCommandCommand.h33
-rw-r--r--Source/cmAddCustomTargetCommand.cxx42
-rw-r--r--Source/cmAddCustomTargetCommand.h31
-rw-r--r--Source/cmAddDefinitionsCommand.cxx16
-rw-r--r--Source/cmAddDefinitionsCommand.h30
-rw-r--r--Source/cmAddDependenciesCommand.cxx21
-rw-r--r--Source/cmAddDependenciesCommand.h29
-rw-r--r--Source/cmAddExecutableCommand.cxx59
-rw-r--r--Source/cmAddExecutableCommand.h30
-rw-r--r--Source/cmAddLibraryCommand.cxx100
-rw-r--r--Source/cmAddLibraryCommand.h30
-rw-r--r--Source/cmAddLinkOptionsCommand.cxx14
-rw-r--r--Source/cmAddLinkOptionsCommand.h24
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx33
-rw-r--r--Source/cmAddSubDirectoryCommand.h31
-rw-r--r--Source/cmAddTestCommand.cxx49
-rw-r--r--Source/cmAddTestCommand.h32
-rw-r--r--Source/cmArchiveWrite.h2
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx21
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h33
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmCommands.cxx39
-rw-r--r--Source/cmComputeLinkInformation.cxx9
-rw-r--r--Source/cmFileCommand.cxx14
-rw-r--r--Source/cmGeneratedFileStream.cxx8
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx20
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx6
-rw-r--r--Source/cmIncludeGuardCommand.cxx2
-rw-r--r--Source/cmInstallCommand.cxx2
-rw-r--r--Source/cmInstallExportGenerator.cxx4
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx5
-rw-r--r--Source/cmLocalGenerator.cxx142
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmMakefile.cxx32
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx2
-rw-r--r--Source/cmMessenger.cxx4
-rw-r--r--Source/cmRuntimeDependencyArchive.cxx4
-rw-r--r--Source/cmStringAlgorithms.cxx14
-rw-r--r--Source/cmStringAlgorithms.h3
-rw-r--r--Source/cmStringCommand.cxx4
-rw-r--r--Source/cmSystemTools.cxx38
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Source/cmTimestamp.cxx2
-rw-r--r--Source/cmUVHandlePtr.cxx6
-rw-r--r--Source/cmUnsetCommand.cxx2
-rw-r--r--Source/cm_codecvt.hxx2
-rw-r--r--Source/cmake.cxx46
-rw-r--r--Source/cmake.h8
-rw-r--r--Source/cmakemain.cxx18
-rw-r--r--Source/cmcmd.cxx24
-rw-r--r--Source/ctest.cxx4
69 files changed, 483 insertions, 849 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ee82ff5..7cd07a8 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -95,9 +95,6 @@ include_directories(
${CMake_HAIKU_INCLUDE_DIRS}
)
-# let cmake know it is supposed to use it
-add_definitions(-DCMAKE_BUILD_WITH_CMAKE)
-
# Check if we can build the ELF parser.
if(CMAKE_USE_ELF_PARSER)
set(ELF_SRCS cmELF.h cmELF.cxx)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 341bd9d..53c1559 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 15)
-set(CMake_VERSION_PATCH 20190810)
+set(CMake_VERSION_PATCH 20190816)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 89c3b1c..ae56adb 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -11,7 +11,7 @@
#include <utility>
#include <vector>
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
@@ -100,7 +100,7 @@ void cpackProgressCallback(const std::string& message, float /*unused*/)
int main(int argc, char const* const* argv)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 65cf646..fb91322 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -689,7 +689,7 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout,
this->TestProcess->SetTimeout(timeout);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::SaveRestoreEnvironment sre;
#endif
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 4288b25..58f88be 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -495,7 +495,7 @@ void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait)
int cmCTestScriptHandler::RunConfigurationScript(
const std::string& total_script_arg, bool pscope)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::SaveRestoreEnvironment sre;
#endif
diff --git a/Source/cmAddCompileDefinitionsCommand.cxx b/Source/cmAddCompileDefinitionsCommand.cxx
index 0474819..b00a4a7 100644
--- a/Source/cmAddCompileDefinitionsCommand.cxx
+++ b/Source/cmAddCompileDefinitionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileDefinitionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddCompileDefinitionsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddCompileDefinition(i);
+ mf.AddCompileDefinition(i);
}
return true;
}
diff --git a/Source/cmAddCompileDefinitionsCommand.h b/Source/cmAddCompileDefinitionsCommand.h
index 5f90ed9..4bd621c 100644
--- a/Source/cmAddCompileDefinitionsCommand.h
+++ b/Source/cmAddCompileDefinitionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddCompileDefinitionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCompileDefinitionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCompileDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCompileOptionsCommand.cxx b/Source/cmAddCompileOptionsCommand.cxx
index 412fb38..8ccb512 100644
--- a/Source/cmAddCompileOptionsCommand.cxx
+++ b/Source/cmAddCompileOptionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddCompileOptionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddCompileOptionsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCompileOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddCompileOption(i);
+ mf.AddCompileOption(i);
}
return true;
}
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index b34b7fc..b172412 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddCompileOptionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCompileOptionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCompileOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 6eb38bd..e502a64 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -8,6 +8,7 @@
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -16,21 +17,22 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
+static bool cmAddCustomCommandCommandCheckOutputs(
+ const std::vector<std::string>& outputs, cmExecutionStatus& status);
-// cmAddCustomCommandCommand
-bool cmAddCustomCommandCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
/* Let's complain at the end of this function about the lack of a particular
arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE
are required.
*/
if (args.size() < 4) {
- this->SetError("called with wrong number of arguments.");
+ status.SetError("called with wrong number of arguments.");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string source, target, main_dependency, working, depfile, job_pool;
std::string comment_buffer;
const char* comment = nullptr;
@@ -167,9 +169,9 @@ bool cmAddCustomCommandCommand::InitialPass(
doing = doing_comment;
} else if (copy == keyDEPFILE) {
doing = doing_depfile;
- if (this->Makefile->GetGlobalGenerator()->GetName() != "Ninja") {
- this->SetError("Option DEPFILE not supported by " +
- this->Makefile->GetGlobalGenerator()->GetName());
+ if (mf.GetGlobalGenerator()->GetName() != "Ninja") {
+ status.SetError("Option DEPFILE not supported by " +
+ mf.GetGlobalGenerator()->GetName());
return false;
}
} else if (copy == keyJOB_POOL) {
@@ -192,7 +194,7 @@ bool cmAddCustomCommandCommand::InitialPass(
// and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt".
// This is fairly obscure so we can wait for someone to
// complain.
- filename = this->Makefile->GetCurrentBinaryDirectory();
+ filename = mf.GetCurrentBinaryDirectory();
filename += "/";
}
filename += copy;
@@ -269,7 +271,7 @@ bool cmAddCustomCommandCommand::InitialPass(
comment = comment_buffer.c_str();
break;
default:
- this->SetError("Wrong syntax. Unknown type of argument.");
+ status.SetError("Wrong syntax. Unknown type of argument.");
return false;
}
}
@@ -284,31 +286,31 @@ bool cmAddCustomCommandCommand::InitialPass(
// At this point we could complain about the lack of arguments. For
// the moment, let's say that COMMAND, TARGET are always required.
if (output.empty() && target.empty()) {
- this->SetError("Wrong syntax. A TARGET or OUTPUT must be specified.");
+ status.SetError("Wrong syntax. A TARGET or OUTPUT must be specified.");
return false;
}
if (source.empty() && !target.empty() && !output.empty()) {
- this->SetError(
+ status.SetError(
"Wrong syntax. A TARGET and OUTPUT can not both be specified.");
return false;
}
if (append && output.empty()) {
- this->SetError("given APPEND option with no OUTPUT.");
+ status.SetError("given APPEND option with no OUTPUT.");
return false;
}
// Make sure the output names and locations are safe.
- if (!this->CheckOutputs(output) || !this->CheckOutputs(outputs) ||
- !this->CheckOutputs(byproducts)) {
+ if (!cmAddCustomCommandCommandCheckOutputs(output, status) ||
+ !cmAddCustomCommandCommandCheckOutputs(outputs, status) ||
+ !cmAddCustomCommandCommandCheckOutputs(byproducts, status)) {
return false;
}
// Check for an append request.
if (append) {
// Lookup an existing command.
- if (cmSourceFile* sf =
- this->Makefile->GetSourceFileWithOutput(output[0])) {
+ if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
cc->AppendCommands(commandLines);
cc->AppendDepends(depends);
@@ -321,12 +323,12 @@ bool cmAddCustomCommandCommand::InitialPass(
std::ostringstream e;
e << "given APPEND option with output\n\"" << output[0]
<< "\"\nwhich is not already a custom command output.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (uses_terminal && !job_pool.empty()) {
- this->SetError("JOB_POOL is shadowed by USES_TERMINAL.");
+ status.SetError("JOB_POOL is shadowed by USES_TERMINAL.");
return false;
}
@@ -335,22 +337,21 @@ bool cmAddCustomCommandCommand::InitialPass(
if (source.empty() && output.empty()) {
// Source is empty, use the target.
std::vector<std::string> no_depends;
- this->Makefile->AddCustomCommandToTarget(
- target, byproducts, no_depends, commandLines, cctype, comment,
- working.c_str(), escapeOldStyle, uses_terminal, depfile, job_pool,
- command_expand_lists);
+ mf.AddCustomCommandToTarget(target, byproducts, no_depends, commandLines,
+ cctype, comment, working.c_str(),
+ escapeOldStyle, uses_terminal, depfile,
+ job_pool, command_expand_lists);
} else if (target.empty()) {
// Target is empty, use the output.
- this->Makefile->AddCustomCommandToOutput(
- output, byproducts, depends, main_dependency, commandLines, comment,
- working.c_str(), false, escapeOldStyle, uses_terminal,
- command_expand_lists, depfile, job_pool);
+ mf.AddCustomCommandToOutput(output, byproducts, depends, main_dependency,
+ commandLines, comment, working.c_str(), false,
+ escapeOldStyle, uses_terminal,
+ command_expand_lists, depfile, job_pool);
// Add implicit dependency scanning requests if any were given.
if (!implicit_depends.empty()) {
bool okay = false;
- if (cmSourceFile* sf =
- this->Makefile->GetSourceFileWithOutput(output[0])) {
+ if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
okay = true;
cc->SetImplicitDepends(implicit_depends);
@@ -360,21 +361,21 @@ bool cmAddCustomCommandCommand::InitialPass(
std::ostringstream e;
e << "could not locate source file with a custom command producing \""
<< output[0] << "\" even though this command tried to create it!";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
} else if (!byproducts.empty()) {
- this->SetError("BYPRODUCTS may not be specified with SOURCE signatures");
+ status.SetError("BYPRODUCTS may not be specified with SOURCE signatures");
return false;
} else if (uses_terminal) {
- this->SetError("USES_TERMINAL may not be used with SOURCE signatures");
+ status.SetError("USES_TERMINAL may not be used with SOURCE signatures");
return false;
} else {
bool issueMessage = true;
std::ostringstream e;
MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0050)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0050)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n";
break;
@@ -391,30 +392,31 @@ bool cmAddCustomCommandCommand::InitialPass(
if (issueMessage) {
e << "The SOURCE signatures of add_custom_command are no longer "
"supported.";
- this->Makefile->IssueMessage(messageType, e.str());
+ mf.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
}
// Use the old-style mode for backward compatibility.
- this->Makefile->AddCustomCommandOldStyle(target, outputs, depends, source,
- commandLines, comment);
+ mf.AddCustomCommandOldStyle(target, outputs, depends, source, commandLines,
+ comment);
}
return true;
}
-bool cmAddCustomCommandCommand::CheckOutputs(
- const std::vector<std::string>& outputs)
+bool cmAddCustomCommandCommandCheckOutputs(
+ const std::vector<std::string>& outputs, cmExecutionStatus& status)
{
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& o : outputs) {
// Make sure the file will not be generated into the source
// directory during an out of source build.
- if (!this->Makefile->CanIWriteThisFile(o)) {
+ if (!mf.CanIWriteThisFile(o)) {
std::string e = "attempted to have a file \"" + o +
"\" in a source directory as an output of custom command.";
- this->SetError(e);
+ status.SetError(e);
cmSystemTools::SetFatalErrorOccured();
return false;
}
@@ -425,7 +427,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
std::ostringstream msg;
msg << "called with OUTPUT containing a \"" << o[pos]
<< "\". This character is not allowed.";
- this->SetError(msg.str());
+ status.SetError(msg.str());
return false;
}
}
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 931aeab..4f8c58f 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -8,38 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddCustomCommandCommand
- * \brief cmAddCustomCommandCommand defines a new command (rule) that can
- * be executed within the build process
- *
- */
-
-class cmAddCustomCommandCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCustomCommandCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-protected:
- bool CheckOutputs(const std::vector<std::string>& outputs);
-};
+bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 0ecd5f5..f812ab5 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -6,6 +6,7 @@
#include <utility>
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -14,17 +15,15 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmAddCustomTargetCommand
-bool cmAddCustomTargetCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string const& targetName = args[0];
// Check the target name.
@@ -33,7 +32,7 @@ bool cmAddCustomTargetCommand::InitialPass(
e << "called with invalid target name \"" << targetName
<< "\". Target names may not contain a slash. "
<< "Use ADD_CUSTOM_COMMAND to generate files.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
@@ -122,7 +121,7 @@ bool cmAddCustomTargetCommand::InitialPass(
case doing_byproducts: {
std::string filename;
if (!cmSystemTools::FileIsFullPath(copy)) {
- filename = this->Makefile->GetCurrentBinaryDirectory();
+ filename = mf.GetCurrentBinaryDirectory();
filename += "/";
}
filename += copy;
@@ -145,7 +144,7 @@ bool cmAddCustomTargetCommand::InitialPass(
job_pool = copy;
break;
default:
- this->SetError("Wrong syntax. Unknown type of argument.");
+ status.SetError("Wrong syntax. Unknown type of argument.");
return false;
}
}
@@ -156,7 +155,7 @@ bool cmAddCustomTargetCommand::InitialPass(
std::ostringstream msg;
msg << "called with target name containing a \"" << targetName[pos]
<< "\". This character is not allowed.";
- this->SetError(msg.str());
+ status.SetError(msg.str());
return false;
}
@@ -168,8 +167,7 @@ bool cmAddCustomTargetCommand::InitialPass(
if (nameOk) {
nameOk = targetName.find(':') == std::string::npos;
}
- if (!nameOk &&
- !this->Makefile->CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
+ if (!nameOk && !mf.CheckCMP0037(targetName, cmStateEnums::UTILITY)) {
return false;
}
@@ -182,39 +180,37 @@ bool cmAddCustomTargetCommand::InitialPass(
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(targetName, msg, true)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(targetName, msg, true)) {
+ status.SetError(msg);
return false;
}
}
if (commandLines.empty() && !byproducts.empty()) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- "BYPRODUCTS may not be specified without any COMMAND");
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ "BYPRODUCTS may not be specified without any COMMAND");
return true;
}
if (commandLines.empty() && uses_terminal) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- "USES_TERMINAL may not be specified without any COMMAND");
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ "USES_TERMINAL may not be specified without any COMMAND");
return true;
}
if (commandLines.empty() && command_expand_lists) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"COMMAND_EXPAND_LISTS may not be specified without any COMMAND");
return true;
}
if (uses_terminal && !job_pool.empty()) {
- this->SetError("JOB_POOL is shadowed by USES_TERMINAL.");
+ status.SetError("JOB_POOL is shadowed by USES_TERMINAL.");
return false;
}
// Add the utility target to the makefile.
bool escapeOldStyle = !verbatim;
- cmTarget* target = this->Makefile->AddUtilityCommand(
+ cmTarget* target = mf.AddUtilityCommand(
targetName, cmMakefile::TargetOrigin::Project, excludeFromAll,
working_directory.c_str(), byproducts, depends, commandLines,
escapeOldStyle, comment, uses_terminal, command_expand_lists, job_pool);
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index db577bc..e23ef9f 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddCustomTargetCommand
- * \brief Command that adds a target to the build system.
- *
- * cmAddCustomTargetCommand adds an extra target to the build system.
- * This is useful when you would like to add special
- * targets like "install,", "clean," and so on.
- */
-class cmAddCustomTargetCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddCustomTargetCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx
index 62e57a3..0b10aee 100644
--- a/Source/cmAddDefinitionsCommand.cxx
+++ b/Source/cmAddDefinitionsCommand.cxx
@@ -2,21 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddDefinitionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmAddDefinitionsCommand
-bool cmAddDefinitionsCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- // it is OK to have no arguments
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddDefineFlag(i);
+ mf.AddDefineFlag(i);
}
return true;
}
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index 0e32c83..a67f095 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddDefinitionsCommand
- * \brief Specify a list of compiler defines
- *
- * cmAddDefinitionsCommand specifies a list of compiler defines. These defines
- * will be added to the compile command.
- */
-class cmAddDefinitionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddDefinitionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 4956a47..0ddbda8 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -4,34 +4,33 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmRange.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmDependenciesCommand
-bool cmAddDependenciesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddDependenciesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string const& target_name = args[0];
- if (this->Makefile->IsAlias(target_name)) {
+ if (mf.IsAlias(target_name)) {
std::ostringstream e;
e << "Cannot add target-level dependencies to alias target \""
<< target_name << "\".\n";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
}
- if (cmTarget* target = this->Makefile->FindTargetToUse(target_name)) {
+ if (cmTarget* target = mf.FindTargetToUse(target_name)) {
// skip over target_name
for (std::string const& arg : cmMakeRange(args).advance(1)) {
- target->AddUtility(arg, this->Makefile);
+ target->AddUtility(arg, &mf);
}
} else {
std::ostringstream e;
@@ -41,7 +40,7 @@ bool cmAddDependenciesCommand::InitialPass(
<< "by the add_executable, add_library, or add_custom_target commands. "
<< "If you want to add file-level dependencies see the DEPENDS option "
<< "of the add_custom_target and add_custom_command commands.";
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
}
return true;
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index ce912d3..0c60e3a 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -8,34 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddDependenciesCommand
- * \brief Add a dependency to a target
- *
- * cmAddDependenciesCommand adds a dependency to a target
- */
-class cmAddDependenciesCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddDependenciesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddDependenciesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 5685fdf..59d6be3 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -4,22 +4,22 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmExecutableCommand
-bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddExecutableCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ cmMakefile& mf = status.GetMakefile();
std::vector<std::string>::const_iterator s = args.begin();
std::string const& exename = *s;
@@ -61,59 +61,58 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = exename.find(':') == std::string::npos;
}
- if (!nameOk &&
- !this->Makefile->CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
+ if (!nameOk && !mf.CheckCMP0037(exename, cmStateEnums::EXECUTABLE)) {
return false;
}
// Special modifiers are not allowed with IMPORTED signature.
if (importTarget && (use_win32 || use_macbundle || excludeFromAll)) {
if (use_win32) {
- this->SetError("may not be given WIN32 for an IMPORTED target.");
+ status.SetError("may not be given WIN32 for an IMPORTED target.");
} else if (use_macbundle) {
- this->SetError("may not be given MACOSX_BUNDLE for an IMPORTED target.");
+ status.SetError(
+ "may not be given MACOSX_BUNDLE for an IMPORTED target.");
} else // if(excludeFromAll)
{
- this->SetError(
+ status.SetError(
"may not be given EXCLUDE_FROM_ALL for an IMPORTED target.");
}
return false;
}
if (isAlias) {
if (!cmGeneratorExpression::IsValidTargetName(exename)) {
- this->SetError("Invalid name for ALIAS: " + exename);
+ status.SetError("Invalid name for ALIAS: " + exename);
return false;
}
if (excludeFromAll) {
- this->SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
+ status.SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
return false;
}
if (importTarget || importGlobal) {
- this->SetError("IMPORTED with ALIAS is not allowed.");
+ status.SetError("IMPORTED with ALIAS is not allowed.");
return false;
}
if (args.size() != 3) {
std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
std::string const& aliasedName = *s;
- if (this->Makefile->IsAlias(aliasedName)) {
+ if (mf.IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is itself an ALIAS.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- cmTarget* aliasedTarget =
- this->Makefile->FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
if (!aliasedTarget) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" does not already exist.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
cmStateEnums::TargetType type = aliasedTarget->GetType();
@@ -121,7 +120,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is not an executable.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (aliasedTarget->IsImported() &&
@@ -129,42 +128,40 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << exename << "\" because target \""
<< aliasedName << "\" is imported but not globally visible.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddAlias(exename, aliasedName);
+ mf.AddAlias(exename, aliasedName);
return true;
}
// Handle imported target creation.
if (importTarget) {
// Make sure the target does not already exist.
- if (this->Makefile->FindTargetToUse(exename)) {
+ if (mf.FindTargetToUse(exename)) {
std::ostringstream e;
e << "cannot create imported target \"" << exename
<< "\" because another target with the same name already exists.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Create the imported target.
- this->Makefile->AddImportedTarget(exename, cmStateEnums::EXECUTABLE,
- importGlobal);
+ mf.AddImportedTarget(exename, cmStateEnums::EXECUTABLE, importGlobal);
return true;
}
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(exename, msg)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(exename, msg)) {
+ status.SetError(msg);
return false;
}
}
std::vector<std::string> srclists(s, args.end());
- cmTarget* tgt =
- this->Makefile->AddExecutable(exename, srclists, excludeFromAll);
+ cmTarget* tgt = mf.AddExecutable(exename, srclists, excludeFromAll);
if (use_win32) {
tgt->SetProperty("WIN32_EXECUTABLE", "ON");
}
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index ec57c3f..f7bc273 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmExecutablesCommand
- * \brief Defines a list of executables to build.
- *
- * cmExecutablesCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmAddExecutableCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddExecutableCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddExecutableCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index ad12e89..626b7c9 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -5,6 +5,7 @@
#include <sstream>
#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -14,21 +15,19 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmLibraryCommand
-bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddLibraryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ cmMakefile& mf = status.GetMakefile();
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
- if (cmSystemTools::IsOff(
- this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
+ if (cmSystemTools::IsOff(mf.GetDefinition("BUILD_SHARED_LIBS"))) {
type = cmStateEnums::STATIC_LIBRARY;
}
bool excludeFromAll = false;
@@ -52,7 +51,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting STATIC type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -62,7 +61,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting SHARED type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -72,7 +71,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting MODULE type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -82,7 +81,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting OBJECT type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -92,7 +91,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting UNKNOWN type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -102,7 +101,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -111,19 +110,19 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (haveSpecifiedType) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting/multiple types.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (isAlias) {
std::ostringstream e;
e << "INTERFACE library specified with conflicting ALIAS type.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (excludeFromAll) {
std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -133,7 +132,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (type == cmStateEnums::INTERFACE_LIBRARY) {
std::ostringstream e;
e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
++s;
@@ -147,7 +146,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
} else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
std::ostringstream e;
e << "GLOBAL option may only be used with IMPORTED libraries.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
} else {
break;
@@ -158,13 +157,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (s != args.end()) {
std::ostringstream e;
e << "INTERFACE library requires no source arguments.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (importGlobal && !importTarget) {
std::ostringstream e;
e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
@@ -175,47 +174,46 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (nameOk && !importTarget && !isAlias) {
nameOk = libName.find(':') == std::string::npos;
}
- if (!nameOk && !this->Makefile->CheckCMP0037(libName, type)) {
+ if (!nameOk && !mf.CheckCMP0037(libName, type)) {
return false;
}
if (isAlias) {
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
- this->SetError("Invalid name for ALIAS: " + libName);
+ status.SetError("Invalid name for ALIAS: " + libName);
return false;
}
if (excludeFromAll) {
- this->SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
+ status.SetError("EXCLUDE_FROM_ALL with ALIAS makes no sense.");
return false;
}
if (importTarget || importGlobal) {
- this->SetError("IMPORTED with ALIAS is not allowed.");
+ status.SetError("IMPORTED with ALIAS is not allowed.");
return false;
}
if (args.size() != 3) {
std::ostringstream e;
e << "ALIAS requires exactly one target argument.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
std::string const& aliasedName = *s;
- if (this->Makefile->IsAlias(aliasedName)) {
+ if (mf.IsAlias(aliasedName)) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is itself an ALIAS.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- cmTarget* aliasedTarget =
- this->Makefile->FindTargetToUse(aliasedName, true);
+ cmTarget* aliasedTarget = mf.FindTargetToUse(aliasedName, true);
if (!aliasedTarget) {
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName
<< "\" does not already "
"exist.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
cmStateEnums::TargetType aliasedType = aliasedTarget->GetType();
@@ -229,7 +227,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is not a library.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
if (aliasedTarget->IsImported() &&
@@ -237,15 +235,15 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << "cannot create ALIAS target \"" << libName << "\" because target \""
<< aliasedName << "\" is imported but not globally visible.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddAlias(libName, aliasedName);
+ mf.AddAlias(libName, aliasedName);
return true;
}
if (importTarget && excludeFromAll) {
- this->SetError("excludeFromAll with IMPORTED target makes no sense.");
+ status.SetError("excludeFromAll with IMPORTED target makes no sense.");
return false;
}
@@ -255,14 +253,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
yet its linker language. */
if ((type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) &&
- !this->Makefile->GetState()->GetGlobalPropertyAsBool(
- "TARGET_SUPPORTS_SHARED_LIBS")) {
+ !mf.GetState()->GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) {
std::ostringstream w;
w << "ADD_LIBRARY called with "
<< (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
<< " option but the target platform does not support dynamic linking. "
"Building a STATIC library instead. This may lead to problems.";
- this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, w.str());
type = cmStateEnums::STATIC_LIBRARY;
}
@@ -270,14 +267,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (importTarget) {
// The IMPORTED signature requires a type to be specified explicitly.
if (!haveSpecifiedType) {
- this->SetError("called with IMPORTED argument but no library type.");
+ status.SetError("called with IMPORTED argument but no library type.");
return false;
}
if (type == cmStateEnums::OBJECT_LIBRARY) {
std::string reason;
- if (!this->Makefile->GetGlobalGenerator()->HasKnownObjectFileLocation(
- &reason)) {
- this->Makefile->IssueMessage(
+ if (!mf.GetGlobalGenerator()->HasKnownObjectFileLocation(&reason)) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The OBJECT library type may not be used for IMPORTED libraries" +
reason + ".");
@@ -288,28 +284,28 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
std::ostringstream e;
e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
// Make sure the target does not already exist.
- if (this->Makefile->FindTargetToUse(libName)) {
+ if (mf.FindTargetToUse(libName)) {
std::ostringstream e;
e << "cannot create imported target \"" << libName
<< "\" because another target with the same name already exists.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Create the imported target.
- this->Makefile->AddImportedTarget(libName, type, importGlobal);
+ mf.AddImportedTarget(libName, type, importGlobal);
return true;
}
// A non-imported target may not have UNKNOWN type.
if (type == cmStateEnums::UNKNOWN_LIBRARY) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The UNKNOWN library type may be used only for IMPORTED libraries.");
return true;
@@ -318,8 +314,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
// Enforce name uniqueness.
{
std::string msg;
- if (!this->Makefile->EnforceUniqueName(libName, msg)) {
- this->SetError(msg);
+ if (!mf.EnforceUniqueName(libName, msg)) {
+ status.SetError(msg);
return false;
}
}
@@ -331,17 +327,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
libName.find("::") != std::string::npos) {
std::ostringstream e;
e << "Invalid name for INTERFACE library target: " << libName;
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
- this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
+ mf.AddLibrary(libName, type, srclists, excludeFromAll);
return true;
}
cmAppend(srclists, s, args.end());
- this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
+ mf.AddLibrary(libName, type, srclists, excludeFromAll);
return true;
}
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 56dab41..609449c 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmLibrarysCommand
- * \brief Defines a list of executables to build.
- *
- * cmLibrarysCommand defines a list of executable (i.e., test)
- * programs to create.
- */
-class cmAddLibraryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddLibraryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddLibraryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx
index 10ebd12..7ed31bd 100644
--- a/Source/cmAddLinkOptionsCommand.cxx
+++ b/Source/cmAddLinkOptionsCommand.cxx
@@ -2,19 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddLinkOptionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-bool cmAddLinkOptionsCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddLinkOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->AddLinkOption(i);
+ mf.AddLinkOption(i);
}
return true;
}
diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h
index 8e46be6..466fc32 100644
--- a/Source/cmAddLinkOptionsCommand.h
+++ b/Source/cmAddLinkOptionsCommand.h
@@ -8,29 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmAddLinkOptionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddLinkOptionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddLinkOptionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 7947188..50c682f 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -5,21 +5,20 @@
#include <sstream>
#include <string.h>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmAddSubDirectoryCommand
-bool cmAddSubDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
// store the binpath
std::string const& srcArg = args.front();
std::string binArg;
@@ -35,7 +34,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (binArg.empty()) {
binArg = arg;
} else {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
}
@@ -46,7 +45,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (cmSystemTools::FileIsFullPath(srcArg)) {
srcPath = srcArg;
} else {
- srcPath = this->Makefile->GetCurrentSourceDirectory();
+ srcPath = mf.GetCurrentSourceDirectory();
srcPath += "/";
srcPath += srcArg;
}
@@ -54,7 +53,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
std::string error = "given source \"";
error += srcArg;
error += "\" which is not an existing directory.";
- this->SetError(error);
+ status.SetError(error);
return false;
}
srcPath = cmSystemTools::CollapseFullPath(srcPath);
@@ -65,22 +64,22 @@ bool cmAddSubDirectoryCommand::InitialPass(
// No binary directory was specified. If the source directory is
// not a subdirectory of the current directory then it is an
// error.
- if (!cmSystemTools::IsSubDirectory(
- srcPath, this->Makefile->GetCurrentSourceDirectory())) {
+ if (!cmSystemTools::IsSubDirectory(srcPath,
+ mf.GetCurrentSourceDirectory())) {
std::ostringstream e;
e << "not given a binary directory but the given source directory "
<< "\"" << srcPath << "\" is not a subdirectory of \""
- << this->Makefile->GetCurrentSourceDirectory() << "\". "
+ << mf.GetCurrentSourceDirectory() << "\". "
<< "When specifying an out-of-tree source a binary directory "
<< "must be explicitly specified.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Remove the CurrentDirectory from the srcPath and replace it
// with the CurrentOutputDirectory.
- const std::string& src = this->Makefile->GetCurrentSourceDirectory();
- const std::string& bin = this->Makefile->GetCurrentBinaryDirectory();
+ const std::string& src = mf.GetCurrentSourceDirectory();
+ const std::string& bin = mf.GetCurrentBinaryDirectory();
size_t srcLen = src.length();
size_t binLen = bin.length();
if (srcLen > 0 && src.back() == '/') {
@@ -96,7 +95,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
if (cmSystemTools::FileIsFullPath(binArg)) {
binPath = binArg;
} else {
- binPath = this->Makefile->GetCurrentBinaryDirectory();
+ binPath = mf.GetCurrentBinaryDirectory();
binPath += "/";
binPath += binArg;
}
@@ -104,7 +103,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
binPath = cmSystemTools::CollapseFullPath(binPath);
// Add the subdirectory using the computed full paths.
- this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, true);
+ mf.AddSubDirectory(srcPath, binPath, excludeFromAll, true);
return true;
}
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index 664334e..87da840 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddSubDirectoryCommand
- * \brief Specify a subdirectory to build
- *
- * cmAddSubDirectoryCommand specifies a subdirectory to process
- * by CMake. CMake will descend
- * into the specified source directory and process any CMakeLists.txt found.
- */
-class cmAddSubDirectoryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddSubDirectoryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAddSubDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index b0c462b..7904bf5 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -4,34 +4,36 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmTest.h"
#include "cmTestGenerator.h"
-class cmExecutionStatus;
+static bool cmAddTestCommandHandleNameMode(
+ std::vector<std::string> const& args, cmExecutionStatus& status);
-// cmExecutableCommand
-bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmAddTestCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (!args.empty() && args[0] == "NAME") {
- return this->HandleNameMode(args);
+ return cmAddTestCommandHandleNameMode(args, status);
}
// First argument is the name of the test Second argument is the name of
// the executable to run (a target or external program) Remaining arguments
// are the arguments to pass to the executable
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
// Collect the command with arguments.
std::vector<std::string> command(args.begin() + 1, args.end());
// Create the test but add a generator only the first time it is
// seen. This preserves behavior from before test generators.
- cmTest* test = this->Makefile->GetTest(args[0]);
+ cmTest* test = mf.GetTest(args[0]);
if (test) {
// If the test was already added by a new-style signature do not
// allow it to be duplicated.
@@ -39,20 +41,21 @@ bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args,
std::ostringstream e;
e << " given test name \"" << args[0]
<< "\" which already exists in this directory.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
} else {
- test = this->Makefile->CreateTest(args[0]);
+ test = mf.CreateTest(args[0]);
test->SetOldStyle(true);
- this->Makefile->AddTestGenerator(new cmTestGenerator(test));
+ mf.AddTestGenerator(new cmTestGenerator(test));
}
test->SetCommand(command);
return true;
}
-bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
+bool cmAddTestCommandHandleNameMode(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
std::string name;
std::vector<std::string> configurations;
@@ -73,25 +76,25 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
for (unsigned int i = 1; i < args.size(); ++i) {
if (args[i] == "COMMAND") {
if (!command.empty()) {
- this->SetError(" may be given at most one COMMAND.");
+ status.SetError(" may be given at most one COMMAND.");
return false;
}
doing = DoingCommand;
} else if (args[i] == "CONFIGURATIONS") {
if (!configurations.empty()) {
- this->SetError(" may be given at most one set of CONFIGURATIONS.");
+ status.SetError(" may be given at most one set of CONFIGURATIONS.");
return false;
}
doing = DoingConfigs;
} else if (args[i] == "WORKING_DIRECTORY") {
if (!working_directory.empty()) {
- this->SetError(" may be given at most one WORKING_DIRECTORY.");
+ status.SetError(" may be given at most one WORKING_DIRECTORY.");
return false;
}
doing = DoingWorkingDirectory;
} else if (args[i] == "COMMAND_EXPAND_LISTS") {
if (command_expand_lists) {
- this->SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
+ status.SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
return false;
}
command_expand_lists = true;
@@ -109,41 +112,43 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
} else {
std::ostringstream e;
e << " given unknown argument:\n " << args[i] << "\n";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
}
// Require a test name.
if (name.empty()) {
- this->SetError(" must be given non-empty NAME.");
+ status.SetError(" must be given non-empty NAME.");
return false;
}
// Require a command.
if (command.empty()) {
- this->SetError(" must be given non-empty COMMAND.");
+ status.SetError(" must be given non-empty COMMAND.");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Require a unique test name within the directory.
- if (this->Makefile->GetTest(name)) {
+ if (mf.GetTest(name)) {
std::ostringstream e;
e << " given test NAME \"" << name
<< "\" which already exists in this directory.";
- this->SetError(e.str());
+ status.SetError(e.str());
return false;
}
// Add the test.
- cmTest* test = this->Makefile->CreateTest(name);
+ cmTest* test = mf.CreateTest(name);
test->SetOldStyle(false);
test->SetCommand(command);
if (!working_directory.empty()) {
test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
}
test->SetCommandExpandLists(command_expand_lists);
- this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
+ mf.AddTestGenerator(new cmTestGenerator(test, configurations));
return true;
}
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 3d37d2b..5877547 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -8,37 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAddTestCommand
- * \brief Add a test to the lists of tests to run.
- *
- * cmAddTestCommand adds a test to the list of tests to run .
- */
-class cmAddTestCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAddTestCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-private:
- bool HandleNameMode(std::vector<std::string> const& args);
-};
+bool cmAddTestCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 9ea88d3..e90a603 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -9,7 +9,7 @@
#include <stddef.h>
#include <string>
-#if !defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(CMAKE_BOOTSTRAP)
# error "cmArchiveWrite not allowed during bootstrap build!"
#endif
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 45c6411..83199b4 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -7,28 +7,27 @@
#include <stddef.h>
#include <utility>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
-class cmExecutionStatus;
-
-// cmAuxSourceDirectoryCommand
-bool cmAuxSourceDirectoryCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
std::string sourceListValue;
std::string const& templateDirectory = args[0];
std::string tdir;
if (!cmSystemTools::FileIsFullPath(templateDirectory)) {
- tdir = this->Makefile->GetCurrentSourceDirectory();
+ tdir = mf.GetCurrentSourceDirectory();
tdir += "/";
tdir += templateDirectory;
} else {
@@ -36,7 +35,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
}
// was the list already populated
- const char* def = this->Makefile->GetDefinition(args[1]);
+ const char* def = mf.GetDefinition(args[1]);
if (def) {
sourceListValue = def;
}
@@ -55,14 +54,14 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
std::string ext = file.substr(dotpos + 1);
std::string base = file.substr(0, dotpos);
// Process only source files
- auto cm = this->Makefile->GetCMakeInstance();
+ auto cm = mf.GetCMakeInstance();
if (!base.empty() && cm->IsSourceExtension(ext)) {
std::string fullname = templateDirectory;
fullname += "/";
fullname += file;
// add the file as a class file so
// depends can be done
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname);
+ cmSourceFile* sf = mf.GetOrCreateSource(fullname);
sf->SetProperty("ABSTRACT", "0");
files.push_back(std::move(fullname));
}
@@ -74,6 +73,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
sourceListValue += ";";
}
sourceListValue += cmJoin(files, ";");
- this->Makefile->AddDefinition(args[1], sourceListValue);
+ mf.AddDefinition(args[1], sourceListValue);
return true;
}
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index 973a464..ae26092 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -8,38 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmAuxSourceDirectoryCommand
- * \brief Specify auxiliary source code directories.
- *
- * cmAuxSourceDirectoryCommand specifies source code directories
- * that must be built as part of this build process. This directories
- * are not recursively processed like the SUBDIR command (cmSubdirCommand).
- * A side effect of this command is to create a subdirectory in the build
- * directory structure.
- */
-class cmAuxSourceDirectoryCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmAuxSourceDirectoryCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 7ea8083..92ed839 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2423,7 +2423,7 @@ int cmCTest::RunCMakeAndTest(std::string* output)
cmCTestBuildAndTestHandler* handler = this->GetBuildAndTestHandler();
int retv = handler->ProcessHandler();
*output = handler->GetOutput();
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
if (retv != 0) {
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index a9be445..8565e1c 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -84,7 +84,7 @@
#include "cmUnsetCommand.h"
#include "cmWhileCommand.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmAddCompileOptionsCommand.h"
# include "cmAddLinkOptionsCommand.h"
# include "cmAuxSourceDirectoryCommand.h"
@@ -210,7 +210,7 @@ void GetScriptingCommands(cmState* state)
"WHILE ENDWHILE structure. Or its arguments did not "
"match the opening WHILE command.");
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand(
"cmake_host_system_information",
cm::make_unique<cmCMakeHostSystemInformationCommand>());
@@ -233,21 +233,14 @@ void GetScriptingCommands(cmState* state)
void GetProjectCommands(cmState* state)
{
- state->AddBuiltinCommand("add_custom_command",
- cm::make_unique<cmAddCustomCommandCommand>());
- state->AddBuiltinCommand("add_custom_target",
- cm::make_unique<cmAddCustomTargetCommand>());
- state->AddBuiltinCommand("add_definitions",
- cm::make_unique<cmAddDefinitionsCommand>());
- state->AddBuiltinCommand("add_dependencies",
- cm::make_unique<cmAddDependenciesCommand>());
- state->AddBuiltinCommand("add_executable",
- cm::make_unique<cmAddExecutableCommand>());
- state->AddBuiltinCommand("add_library",
- cm::make_unique<cmAddLibraryCommand>());
- state->AddBuiltinCommand("add_subdirectory",
- cm::make_unique<cmAddSubDirectoryCommand>());
- state->AddBuiltinCommand("add_test", cm::make_unique<cmAddTestCommand>());
+ state->AddBuiltinCommand("add_custom_command", cmAddCustomCommandCommand);
+ state->AddBuiltinCommand("add_custom_target", cmAddCustomTargetCommand);
+ state->AddBuiltinCommand("add_definitions", cmAddDefinitionsCommand);
+ state->AddBuiltinCommand("add_dependencies", cmAddDependenciesCommand);
+ state->AddBuiltinCommand("add_executable", cmAddExecutableCommand);
+ state->AddBuiltinCommand("add_library", cmAddLibraryCommand);
+ state->AddBuiltinCommand("add_subdirectory", cmAddSubDirectoryCommand);
+ state->AddBuiltinCommand("add_test", cmAddTestCommand);
state->AddBuiltinCommand("build_command", cm::make_unique<cmBuildCommand>());
state->AddBuiltinCommand("create_test_sourcelist",
cm::make_unique<cmCreateTestSourceList>());
@@ -301,13 +294,12 @@ void GetProjectCommands(cmState* state)
cm::make_unique<cmTryCompileCommand>());
state->AddBuiltinCommand("try_run", cm::make_unique<cmTryRunCommand>());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
state->AddBuiltinCommand("add_compile_definitions",
- cm::make_unique<cmAddCompileDefinitionsCommand>());
- state->AddBuiltinCommand("add_compile_options",
- cm::make_unique<cmAddCompileOptionsCommand>());
+ cmAddCompileDefinitionsCommand);
+ state->AddBuiltinCommand("add_compile_options", cmAddCompileOptionsCommand);
state->AddBuiltinCommand("aux_source_directory",
- cm::make_unique<cmAuxSourceDirectoryCommand>());
+ cmAuxSourceDirectoryCommand);
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
state->AddBuiltinCommand("fltk_wrap_ui",
cm::make_unique<cmFLTKWrapUICommand>());
@@ -316,8 +308,7 @@ void GetProjectCommands(cmState* state)
cm::make_unique<cmIncludeExternalMSProjectCommand>());
state->AddBuiltinCommand("install_programs",
cm::make_unique<cmInstallProgramsCommand>());
- state->AddBuiltinCommand("add_link_options",
- cm::make_unique<cmAddLinkOptionsCommand>());
+ state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
state->AddBuiltinCommand("link_libraries",
cm::make_unique<cmLinkLibrariesCommand>());
state->AddBuiltinCommand("target_link_options",
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 4aa18f2..0741f8b 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -285,8 +285,13 @@ cmComputeLinkInformation::cmComputeLinkInformation(
}
// Get options needed to link libraries.
- this->LibLinkFlag =
- this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ if (const char* flag = this->Makefile->GetDefinition(
+ "CMAKE_" + this->LinkLanguage + "_LINK_LIBRARY_FLAG")) {
+ this->LibLinkFlag = flag;
+ } else {
+ this->LibLinkFlag =
+ this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+ }
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
this->LibLinkSuffix =
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index db73926..87e97dd 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -47,7 +47,7 @@
#include "cm_sys_stat.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCurl.h"
# include "cmFileLockResult.h"
# include "cm_curl.h"
@@ -275,7 +275,7 @@ bool HandleReadCommand(std::vector<std::string> const& args,
bool HandleHashCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() != 3) {
std::ostringstream e;
e << args[0] << " requires a file name and output variable";
@@ -1356,7 +1356,7 @@ bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
if (cmSystemTools::FileIsDirectory(fileName) &&
!cmSystemTools::FileIsSymlink(fileName) && recurse) {
- cmSystemTools::RemoveADirectory(fileName);
+ cmSystemTools::RepeatedRemoveDirectory(fileName);
} else {
cmSystemTools::RemoveFile(fileName);
}
@@ -1426,7 +1426,7 @@ bool HandleNativePathCommand(std::vector<std::string> const& args,
return HandlePathCommand(args, ToNativePath, status);
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Stuff for curl download/upload
typedef std::vector<char> cmFileCommandVectorOfChar;
@@ -1592,7 +1592,7 @@ private:
bool HandleDownloadCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::vector<std::string>::const_iterator i = args.begin();
if (args.size() < 3) {
status.SetError("DOWNLOAD must be called with at least three arguments.");
@@ -1961,7 +1961,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
bool HandleUploadCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() < 3) {
status.SetError("UPLOAD must be called with at least three arguments.");
return false;
@@ -2292,7 +2292,7 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
bool HandleLockCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Default values
bool directory = false;
bool release = false;
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 2f47788..7475e9f 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -6,14 +6,14 @@
#include "cmSystemTools.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_codecvt.hxx"
# include "cm_zlib.h"
#endif
cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (encoding != codecvt::None) {
imbue(std::locale(getloc(), new codecvt(encoding)));
}
@@ -32,7 +32,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name,
cmSystemTools::Error("Cannot open file for write: " + this->TempName);
cmSystemTools::ReportLastSystemError("");
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (encoding != codecvt::None) {
imbue(std::locale(getloc(), new codecvt(encoding)));
}
@@ -169,7 +169,7 @@ bool cmGeneratedFileStreamBase::Close()
return replaced;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
int cmGeneratedFileStreamBase::CompressFile(std::string const& oldname,
std::string const& newname)
{
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 03fc5ae..c07d7af 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2526,7 +2526,7 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
info.WindowsExportAllSymbols =
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
this->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS");
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
info.DefFileGenerated =
info.WindowsExportAllSymbols || info.Sources.size() > 1;
#else
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 88da5eb..4db5ca8 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -44,7 +44,7 @@
#include "cmWorkingDirectory.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCryptoHash.h"
# include "cmQtAutoGenGlobalInitializer.h"
# include "cm_jsoncpp_value.h"
@@ -114,7 +114,7 @@ cmGlobalGenerator::~cmGlobalGenerator()
this->ClearGeneratorMembers();
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalGenerator::GetJson() const
{
Json::Value generator = Json::objectValue;
@@ -1547,7 +1547,7 @@ bool cmGlobalGenerator::ComputeTargetDepends()
bool cmGlobalGenerator::QtAutoGen()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmQtAutoGenGlobalInitializer initializer(this->LocalGenerators);
return initializer.generate();
#else
@@ -2270,14 +2270,6 @@ bool cmGlobalGenerator::NameResolvesToFramework(
return false;
}
-inline std::string removeQuotes(const std::string& s)
-{
- if (s.front() == '\"' && s.back() == '\"') {
- return s.substr(1, s.size() - 2);
- }
- return s;
-}
-
bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName,
std::string const& reason) const
{
@@ -2829,7 +2821,7 @@ std::set<std::string> const& cmGlobalGenerator::GetDirectoryContent(
void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
std::string const& content)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Ignore if there are no outputs.
if (outputs.empty()) {
return;
@@ -2859,7 +2851,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
void cmGlobalGenerator::CheckRuleHashes()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory();
std::string pfile = home;
pfile += "/CMakeFiles";
@@ -2963,7 +2955,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
file += "/Labels.txt";
std::string json_file = dir + "/Labels.json";
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Check whether labels are enabled for this target.
const char* targetLabels = target->GetProperty("LABELS");
const char* directoryLabels =
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ea40ebc..830974d 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -25,7 +25,7 @@
#include "cmTargetDepend.h"
#include "cm_codecvt.hxx"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmFileLockPool.h"
# include "cm_jsoncpp_value.h"
#endif
@@ -109,7 +109,7 @@ public:
return codecvt::None;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
/** Get a JSON object describing the generator. */
virtual Json::Value GetJson() const;
#endif
@@ -462,7 +462,7 @@ public:
const std::set<const cmGeneratorTarget*>& GetFilenameTargetDepends(
cmSourceFile* sf) const;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif
@@ -665,7 +665,7 @@ private:
mutable std::map<cmSourceFile*, std::set<cmGeneratorTarget const*>>
FilenameTargetDepends;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Pool of file locks
cmFileLockPool FileLockPool;
#endif
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index ca80d3b..cd1ff61 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -256,7 +256,7 @@ cmLocalGenerator* cmGlobalVisualStudio7Generator::CreateLocalGenerator(
return lg;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmGlobalVisualStudio7Generator::GetJson() const
{
Json::Value generator = this->cmGlobalVisualStudioGenerator::GetJson();
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index f004afb..9b84732 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -23,7 +23,7 @@ public:
//! Create a local generator appropriate to this Global Generator
cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value GetJson() const override;
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 029b976..e3cafe3 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -38,12 +38,12 @@
struct cmLinkImplementation;
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(__APPLE__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__)
# define HAVE_APPLICATION_SERVICES
# include <ApplicationServices/ApplicationServices.h>
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmXMLParser.h"
// parse the xml file storing the installed version of Xcode on
@@ -188,7 +188,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
if (name != GetActualName()) {
return nullptr;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmXcodeVersionParser parser;
std::string versionFile;
{
diff --git a/Source/cmIncludeGuardCommand.cxx b/Source/cmIncludeGuardCommand.cxx
index 3b126b0..e560910 100644
--- a/Source/cmIncludeGuardCommand.cxx
+++ b/Source/cmIncludeGuardCommand.cxx
@@ -21,7 +21,7 @@ enum IncludeGuardScope
std::string GetIncludeGuardVariableName(std::string const& filePath)
{
std::string result = "__INCGUARD_";
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
result += cmSystemTools::ComputeStringMD5(filePath);
#else
result += cmSystemTools::MakeCidentifier(filePath);
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 5349a9d..76dafd9 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1268,7 +1268,7 @@ bool cmInstallCommand::HandleDirectoryMode(
bool cmInstallCommand::HandleExportAndroidMKMode(
std::vector<std::string> const& args)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// This is the EXPORT mode.
cmInstallCommandArguments ica(this->DefaultComponentName);
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index f5bedab..af06b9d 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -7,7 +7,7 @@
#include <sstream>
#include <utility>
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmExportInstallAndroidMKGenerator.h"
#endif
#include "cmExportInstallFileGenerator.h"
@@ -31,7 +31,7 @@ cmInstallExportGenerator::cmInstallExportGenerator(
, LocalGenerator(nullptr)
{
if (android) {
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->EFGen = new cmExportInstallAndroidMKGenerator(this);
#endif
} else {
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 656907a..7cacb24 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
@@ -156,6 +157,10 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
return false;
}
+ if (!lg.GetMakefile()->IsOn("CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE")) {
+ return false;
+ }
+
if (const char* resolveDeviceSymbols =
target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
// If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3deaeb0..228495b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -29,7 +29,7 @@
#include "cmake.h"
#include "cmsys/RegularExpression.hxx"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# define CM_LG_ENCODE_OBJECT_NAMES
# include "cmCryptoHash.h"
#endif
@@ -745,12 +745,10 @@ std::string cmLocalGenerator::GetIncludeFlags(
OutputFormat shellFormat = forResponseFile ? RESPONSE : SHELL;
std::ostringstream includeFlags;
- std::string flagVar = "CMAKE_INCLUDE_FLAG_";
- flagVar += lang;
- std::string const& includeFlag = this->Makefile->GetSafeDefinition(flagVar);
- flagVar = "CMAKE_INCLUDE_FLAG_SEP_";
- flagVar += lang;
- const char* sep = this->Makefile->GetDefinition(flagVar);
+ std::string const& includeFlag =
+ this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_", lang));
+ const char* sep =
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang));
bool quotePaths = false;
if (this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) {
quotePaths = true;
@@ -767,23 +765,16 @@ std::string cmLocalGenerator::GetIncludeFlags(
// Support special system include flag if it is available and the
// normal flag is repeated for each directory.
- std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
- sysFlagVar += lang;
const char* sysIncludeFlag = nullptr;
if (repeatFlag) {
- sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar);
+ sysIncludeFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_INCLUDE_SYSTEM_FLAG_", lang));
}
- std::string fwSearchFlagVar = "CMAKE_";
- fwSearchFlagVar += lang;
- fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar);
-
- std::string sysFwSearchFlagVar = "CMAKE_";
- sysFwSearchFlagVar += lang;
- sysFwSearchFlagVar += "_SYSTEM_FRAMEWORK_SEARCH_FLAG";
- const char* sysFwSearchFlag =
- this->Makefile->GetDefinition(sysFwSearchFlagVar);
+ const char* fwSearchFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_FRAMEWORK_SEARCH_FLAG"));
+ const char* sysFwSearchFlag = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_SYSTEM_FRAMEWORK_SEARCH_FLAG"));
bool flagUsed = false;
std::set<std::string> emitted;
@@ -793,9 +784,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
for (std::string const& i : includes) {
if (fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE") &&
cmSystemTools::IsPathToFramework(i)) {
- std::string frameworkDir = i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ std::string const frameworkDir =
+ cmSystemTools::CollapseFullPath(cmStrCat(i, "/../"));
if (emitted.insert(frameworkDir).second) {
if (sysFwSearchFlag && target &&
target->IsSystemIncludeDirectory(i, config, lang)) {
@@ -963,10 +953,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// These are intended to simulate additional implicit include directories.
std::vector<std::string> userStandardDirs;
{
- std::string key = "CMAKE_";
- key += lang;
- key += "_STANDARD_INCLUDE_DIRECTORIES";
- std::string const value = this->Makefile->GetSafeDefinition(key);
+ std::string const value = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_STANDARD_INCLUDE_DIRECTORIES"));
cmSystemTools::ExpandListArgument(value, userStandardDirs);
for (std::string& usd : userStandardDirs) {
cmSystemTools::ConvertToUnixSlashes(usd);
@@ -989,10 +977,9 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// * Compilers like gfortran do not search their own implicit include
// directories for modules ('.mod' files).
if (lang != "Fortran") {
- std::string key = "CMAKE_";
- key += lang;
- key += "_IMPLICIT_INCLUDE_DIRECTORIES";
- if (const char* value = this->Makefile->GetDefinition(key)) {
+ const char* value = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"));
+ if (value != nullptr) {
size_t const impDirVecOldSize = impDirVec.size();
cmSystemTools::ExpandListArgument(value, impDirVec);
// FIXME: Use cmRange with 'advance()' when it supports non-const.
@@ -1210,9 +1197,8 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
if (!buildType.empty()) {
- std::string configLinkFlags = "LINK_FLAGS_";
- configLinkFlags += buildType;
- targetLinkFlags = target->GetProperty(configLinkFlags);
+ targetLinkFlags =
+ target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
@@ -1234,9 +1220,8 @@ void cmLocalGenerator::GetTargetFlags(
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if (!buildType.empty()) {
- std::string build = "CMAKE_EXE_LINKER_FLAGS_";
- build += buildType;
- linkFlags += this->Makefile->GetSafeDefinition(build);
+ linkFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_EXE_LINKER_FLAGS_", buildType));
linkFlags += " ";
}
if (linkLanguage.empty()) {
@@ -1257,11 +1242,8 @@ void cmLocalGenerator::GetTargetFlags(
}
if (target->IsExecutableWithExports()) {
- std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
- exportFlagVar += linkLanguage;
- exportFlagVar += "_FLAG";
-
- linkFlags += this->Makefile->GetSafeDefinition(exportFlagVar);
+ linkFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"));
linkFlags += " ";
}
}
@@ -1293,9 +1275,8 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
if (!buildType.empty()) {
- std::string configLinkFlags = "LINK_FLAGS_";
- configLinkFlags += buildType;
- targetLinkFlags = target->GetProperty(configLinkFlags);
+ targetLinkFlags =
+ target->GetProperty(cmStrCat("LINK_FLAGS_", buildType));
if (targetLinkFlags) {
linkFlags += targetLinkFlags;
linkFlags += " ";
@@ -1470,20 +1451,12 @@ void cmLocalGenerator::OutputLinkLibraries(
}
// Add standard libraries for this language.
- std::string standardLibsVar = "CMAKE_";
- standardLibsVar += cli.GetLinkLanguage();
- standardLibsVar += "_STANDARD_LIBRARIES";
- std::string stdLibString;
- if (const char* stdLibs = this->Makefile->GetDefinition(standardLibsVar)) {
- stdLibString = stdLibs;
- }
+ std::string stdLibString = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", cli.GetLinkLanguage(), "_STANDARD_LIBRARIES"));
// Append the framework search path flags.
- std::string fwSearchFlagVar = "CMAKE_";
- fwSearchFlagVar += linkLanguage;
- fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
- std::string fwSearchFlag =
- this->Makefile->GetSafeDefinition(fwSearchFlagVar);
+ std::string fwSearchFlag = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", linkLanguage, "_FRAMEWORK_SEARCH_FLAG"));
frameworkPath = linkLineComputer->ComputeFrameworkPath(cli, fwSearchFlag);
linkPath =
@@ -1538,10 +1511,8 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
}
if (add_shlib_flags) {
- std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_";
- linkFlagsVar += linkLanguage;
- linkFlagsVar += "_FLAGS";
- linkFlags = this->Makefile->GetSafeDefinition(linkFlagsVar);
+ linkFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_SHARED_LIBRARY_LINK_", linkLanguage, "_FLAGS"));
}
}
return linkFlags;
@@ -1599,10 +1570,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
const std::string& config)
{
// Add language-specific flags.
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
- this->AddConfigVariableFlags(flags, flagsVar, config);
+ this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
+ config);
// Add MSVC runtime library flags. This is activated by the presence
// of a default selection whether or not it is overridden by a property.
@@ -1773,10 +1742,9 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
// Add flags for dealing with shared libraries for this language.
if (shared) {
- flagsVar = "CMAKE_SHARED_LIBRARY_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
- this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar));
+ this->AppendFlags(flags,
+ this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS")));
}
}
@@ -2065,9 +2033,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
std::string originalFlags =
this->GlobalGenerator->GetSharedLibFlagsForLanguage(lang);
if (shared) {
- std::string flagsVar = "CMAKE_SHARED_LIBRARY_";
- flagsVar += lang;
- flagsVar += "_FLAGS";
+ std::string flagsVar = cmStrCat("CMAKE_SHARED_LIBRARY_", lang, "_FLAGS");
std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
if (flags != originalFlags) {
@@ -2106,16 +2072,12 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
std::string picFlags;
if (targetType == cmStateEnums::EXECUTABLE) {
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_COMPILE_OPTIONS_PIE";
- picFlags = this->Makefile->GetSafeDefinition(flagsVar);
+ picFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIE"));
}
if (picFlags.empty()) {
- std::string flagsVar = "CMAKE_";
- flagsVar += lang;
- flagsVar += "_COMPILE_OPTIONS_PIC";
- picFlags = this->Makefile->GetSafeDefinition(flagsVar);
+ picFlags = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIC"));
}
if (!picFlags.empty()) {
std::vector<std::string> options;
@@ -2356,10 +2318,8 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
// Lookup the define flag for the current language.
std::string dflag = "-D";
if (!lang.empty()) {
- std::string defineFlagVar = "CMAKE_";
- defineFlagVar += lang;
- defineFlagVar += "_DEFINE_FLAG";
- const char* df = this->Makefile->GetDefinition(defineFlagVar);
+ const char* df =
+ this->Makefile->GetDefinition(cmStrCat("CMAKE_", lang, "_DEFINE_FLAG"));
if (df && *df) {
dflag = df;
}
@@ -2405,11 +2365,9 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
const std::string& lang,
const char* feature)
{
- std::string optVar = "CMAKE_";
- optVar += lang;
- optVar += "_COMPILE_OPTIONS_";
- optVar += feature;
- if (const char* optionList = this->Makefile->GetDefinition(optVar)) {
+ const char* optionList = this->Makefile->GetDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
+ if (optionList != nullptr) {
std::vector<std::string> options;
cmSystemTools::ExpandListArgument(optionList, options);
for (std::string const& o : options) {
@@ -2762,10 +2720,8 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
if (!replaceExt) {
std::string lang = source.GetLanguage();
if (!lang.empty()) {
- std::string repVar = "CMAKE_";
- repVar += lang;
- repVar += "_OUTPUT_EXTENSION_REPLACE";
- replaceExt = this->Makefile->IsOn(repVar);
+ replaceExt = this->Makefile->IsOn(
+ cmStrCat("CMAKE_", lang, "_OUTPUT_EXTENSION_REPLACE"));
}
}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f0c6806..455e491 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -461,7 +461,7 @@ private:
void ComputeObjectMaxPath();
};
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
bool cmLocalGeneratorCheckObjectName(std::string& objName,
std::string::size_type dir_len,
std::string::size_type max_total_len);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c6b63ba..cfad31a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -40,7 +40,7 @@
// Include dependency scanners for supported languages. Only the
// C/C++ scanner is needed for bootstrapping CMake.
#include "cmDependsC.h"
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmDependsFortran.h"
# include "cmDependsJava.h"
#endif
@@ -1477,7 +1477,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// TODO: Handle RC (resource files) dependencies correctly.
scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
else if (lang == "Fortran") {
ruleFileStream << "# Note that incremental build could trigger "
<< "a call to cmake_copy_f90_mod on each re-build\n";
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 86a002f..f6f4737 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -47,7 +47,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmVariableWatch.h"
#endif
@@ -97,7 +97,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
// cmListFileCache in the top level if necessary.
this->CheckCMP0000 = false;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->AddSourceGroup("", "^.*$");
this->AddSourceGroup("Source Files", CM_SOURCE_REGEX);
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
@@ -1425,7 +1425,7 @@ void cmMakefile::PushFunctionScope(std::string const& fileName,
this->PushLoopBlockBarrier();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope();
#endif
@@ -1442,7 +1442,7 @@ void cmMakefile::PopFunctionScope(bool reportError)
this->PopFunctionBlockerBarrier(reportError);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope();
#endif
@@ -1497,7 +1497,7 @@ public:
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
this->GG->SetCurrentMakefile(mf);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GG->GetFileLockPool().PushFileScope();
#endif
}
@@ -1506,7 +1506,7 @@ public:
{
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
this->Makefile->PopSnapshot(this->ReportError);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GG->GetFileLockPool().PopFileScope();
#endif
this->GG->SetCurrentMakefile(this->CurrentMakefile);
@@ -1800,7 +1800,7 @@ void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
}
this->StateSnapshot.SetDefinition(name, value);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
@@ -1921,7 +1921,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
this->LogUnused("unsetting", name);
}
this->StateSnapshot.RemoveDefinition(name);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS,
@@ -2079,7 +2079,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
return nullptr;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmSourceGroup* cmMakefile::GetSourceGroup(
const std::vector<std::string>& name) const
{
@@ -2460,7 +2460,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if (cmVariableWatch* vv = this->GetVariableWatch()) {
if (!def) {
vv->VariableAccessed(
@@ -2477,7 +2477,7 @@ const std::string* cmMakefile::GetDef(const std::string& name) const
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv && !this->SuppressSideEffects) {
bool const watch_function_executed =
@@ -3327,7 +3327,7 @@ void cmMakefile::AddTargetObject(std::string const& tgtName,
cmSourceFile* sf = this->GetOrCreateSource(objFile, true);
sf->SetObjectLibrary(tgtName);
sf->SetProperty("EXTERNAL_OBJECT", "1");
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->SourceGroups[this->ObjectLibrariesSourceGroupIndex].AddGroupFile(
sf->GetFullPath());
#endif
@@ -3509,7 +3509,7 @@ cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
return this->GlobalGenerator;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* cmMakefile::GetVariableWatch() const
{
if (this->GetCMakeInstance() &&
@@ -3931,14 +3931,14 @@ void cmMakefile::PushScope()
this->GetState()->CreateVariableScopeSnapshot(this->StateSnapshot);
this->PushLoopBlockBarrier();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope();
#endif
}
void cmMakefile::PopScope()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope();
#endif
@@ -3962,7 +3962,7 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef)
return;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* vv = this->GetVariableWatch();
if (vv) {
vv->VariableAccessed(var, cmVariableWatch::VARIABLE_MODIFIED_ACCESS,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 4d61c05..a6d1757 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -30,7 +30,7 @@
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmSourceGroup.h"
#endif
@@ -503,7 +503,7 @@ public:
*/
bool CanIWriteThisFile(std::string const& fileName) const;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
/**
* Get the vector source groups.
*/
@@ -649,7 +649,7 @@ public:
* Get the variable watch. This is used to determine when certain variables
* are accessed.
*/
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmVariableWatch* GetVariableWatch() const;
#endif
@@ -945,7 +945,7 @@ protected:
// Track the value of the computed DEFINITIONS property.
std::string DefineFlagsOrig;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::vector<cmSourceGroup> SourceGroups;
size_t ObjectLibrariesSourceGroupIndex;
#endif
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 19c667e..31ee4fa 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -83,7 +83,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
bool relink)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
const bool requiresDeviceLinking = requireDeviceLinking(
*this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
if (!requiresDeviceLinking) {
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 8d342f3..4621da4 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -236,7 +236,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
const std::string& linkRuleVar, bool relink)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// TODO: Merge the methods that call this method to avoid
// code duplication.
std::vector<std::string> commands;
diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx
index 07d011e..af83478 100644
--- a/Source/cmMessenger.cxx
+++ b/Source/cmMessenger.cxx
@@ -6,7 +6,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmsys/SystemInformation.hxx"
#endif
@@ -106,7 +106,7 @@ void displayMessage(MessageType t, std::ostringstream& msg)
// Add a terminating blank line.
msg << "\n";
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Add a C++ stack trace to internal errors.
if (t == MessageType::INTERNAL_ERROR) {
std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0);
diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx
index ca85287..37a87e5 100644
--- a/Source/cmRuntimeDependencyArchive.cxx
+++ b/Source/cmRuntimeDependencyArchive.cxx
@@ -13,7 +13,7 @@
#if defined(_WIN32)
# include "cmGlobalGenerator.h"
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
# include "cmGlobalVisualStudioVersionedGenerator.h"
# endif
# include "cmVSSetupHelper.h"
@@ -36,7 +36,7 @@ static void AddVisualStudioPath(std::vector<std::string>& paths,
// If generating for the VS IDE, use the same instance.
std::string vsloc;
bool found = false;
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
if (gg->GetName().find(prefix) == 0) {
cmGlobalVisualStudioVersionedGenerator* vsgen =
static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index 0703e55..fa47d77 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -23,6 +23,20 @@ std::string cmTrimWhitespace(cm::string_view str)
return std::string(start, stop + 1);
}
+std::string cmRemoveQuotes(cm::string_view str)
+{
+ // We process only strings that have two quotes at least.
+ // Also front() and back() are only defined behavior on non empty strings.
+ if (str.size() >= 2 && //
+ str.front() == '"' && //
+ str.back() == '"') {
+ // Remove a quote from the front and back
+ str.remove_prefix(1);
+ str.remove_suffix(1);
+ }
+ return std::string(str);
+}
+
std::string cmEscapeQuotes(cm::string_view str)
{
std::string result;
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 3656619..968cc14 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -41,6 +41,9 @@ inline bool cmIsSpace(char ch)
/** Returns a string that has whitespace removed from the start and the end. */
std::string cmTrimWhitespace(cm::string_view str);
+/** Returns a string that has quotes removed from the start and the end. */
+std::string cmRemoveQuotes(cm::string_view str);
+
/** Escape quotes in a string. */
std::string cmEscapeQuotes(cm::string_view str);
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 1af4204..41d48ed 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -113,7 +113,7 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args,
bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args.size() != 3) {
std::ostringstream e;
e << args[0] << " requires an output variable and an input string";
@@ -878,7 +878,7 @@ bool cmStringCommand::HandleTimestampCommand(
bool cmStringCommand::HandleUuidCommand(std::vector<std::string> const& args)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
unsigned int argsIndex = 1;
if (args.size() < 2) {
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index f1a652d..9341f83 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -9,7 +9,7 @@
#include "cmStringAlgorithms.h"
#include "cm_uv.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmArchiveWrite.h"
# include "cmLocale.h"
# include "cm_libarchive.h"
@@ -21,7 +21,7 @@
# endif
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmCryptoHash.h"
#endif
@@ -93,7 +93,7 @@ extern char** environ;
# endif
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
static std::string cm_archive_entry_pathname(struct archive_entry* entry)
{
# if cmsys_STL_HAS_WSTRING
@@ -944,7 +944,7 @@ bool cmSystemTools::RenameFile(const std::string& oldname,
std::string cmSystemTools::ComputeFileHash(const std::string& source,
cmCryptoHash::Algo algo)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash hash(algo);
return hash.HashFile(source);
#else
@@ -957,7 +957,7 @@ std::string cmSystemTools::ComputeFileHash(const std::string& source,
std::string cmSystemTools::ComputeStringMD5(const std::string& input)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
return md5.HashString(input);
#else
@@ -973,7 +973,7 @@ std::string cmSystemTools::ComputeCertificateThumbprint(
{
std::string thumbprint;
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
BYTE* certData = NULL;
CRYPT_INTEGER_BLOB cryptBlob;
HCERTSTORE certStore = NULL;
@@ -1331,7 +1331,7 @@ std::string cmSystemTools::ForceToRelativePath(std::string const& local_path,
return relative;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
bool cmSystemTools::UnsetEnv(const char* value)
{
# if !defined(HAVE_UNSETENV)
@@ -1396,7 +1396,7 @@ void cmSystemTools::EnableVSConsoleOutput()
// output and allow it to be captured on the fly.
cmSystemTools::PutEnv("vsconsoleoutput=1");
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
// VS sets an environment variable to tell MS tools like "cl" to report
// output through a backdoor pipe instead of stdout/stderr. Unset the
// environment variable to close this backdoor for any path of process
@@ -1418,7 +1418,7 @@ bool cmSystemTools::CreateTar(const std::string& outFileName,
std::string const& mtime,
std::string const& format)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmsys::ofstream fout(outFileName.c_str(), std::ios::out | std::ios::binary);
if (!fout) {
@@ -1472,7 +1472,7 @@ bool cmSystemTools::CreateTar(const std::string& outFileName,
#endif
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
namespace {
# define BSDTAR_FILESIZE_PRINTF "%lu"
# define BSDTAR_FILESIZE_TYPE unsigned long
@@ -1768,7 +1768,7 @@ bool cmSystemTools::ExtractTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
return extract_tar(outFileName, files, verbose, true);
#else
(void)outFileName;
@@ -1782,7 +1782,7 @@ bool cmSystemTools::ListTar(const std::string& outFileName,
const std::vector<std::string>& files,
bool verbose)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
return extract_tar(outFileName, files, verbose, false);
#else
(void)outFileName;
@@ -2111,7 +2111,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMakeCommand = exe_dir;
cmSystemToolsCMakeCommand += "/cmake";
cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension();
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
// The bootstrap cmake does not provide the other tools,
// so use the directory where they are about to be built.
exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
@@ -2141,7 +2141,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
cmSystemToolsCMClDepsCommand.clear();
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Install tree has
// - "<prefix><CMAKE_BIN_DIR>/cmake"
// - "<prefix><CMAKE_DATA_DIR>"
@@ -2838,14 +2838,20 @@ bool cmSystemTools::CheckRPath(std::string const& file,
bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
{
+#ifdef _WIN32
// Windows sometimes locks files temporarily so try a few times.
- for (int i = 0; i < 10; ++i) {
+ WindowsFileRetry retry = cmSystemTools::GetWindowsFileRetry();
+
+ for (unsigned int i = 0; i < retry.Count; ++i) {
if (cmSystemTools::RemoveADirectory(dir)) {
return true;
}
- cmSystemTools::Delay(100);
+ cmSystemTools::Delay(retry.Delay);
}
return false;
+#else
+ return cmSystemTools::RemoveADirectory(dir);
+#endif
}
std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 0c941cb..4bb6730 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -387,7 +387,7 @@ public:
static std::string ForceToRelativePath(std::string const& local_path,
std::string const& remote_path);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
/** Remove an environment variable */
static bool UnsetEnv(const char* value);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7ca2391..bf2419a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -343,6 +343,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("CUDA_EXTENSIONS");
initProp("CUDA_COMPILER_LAUNCHER");
initProp("CUDA_SEPARABLE_COMPILATION");
+ initProp("CUDA_RESOLVE_DEVICE_SYMBOLS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
initProp("FOLDER");
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx
index da5d21e..0915986 100644
--- a/Source/cmTimestamp.cxx
+++ b/Source/cmTimestamp.cxx
@@ -109,7 +109,7 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
time_t result = mktime(&tm);
-# ifdef CMAKE_BUILD_WITH_CMAKE
+# ifndef CMAKE_BOOTSTRAP
if (tz_was_set) {
cmSystemTools::PutEnv(tz_old);
} else {
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index db67463..97c27cb 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -122,7 +122,7 @@ uv_handle_ptr_<T>::operator T*() const
return this->handle.get();
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
template <>
struct uv_handle_deleter<uv_async_t>
{
@@ -230,7 +230,7 @@ int uv_timer_ptr::start(uv_timer_cb cb, uint64_t timeout, uint64_t repeat)
return uv_timer_start(*this, cb, timeout, repeat);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
uv_tty_ptr::operator uv_stream_t*() const
{
return reinterpret_cast<uv_stream_t*>(handle.get());
@@ -259,7 +259,7 @@ UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(process)
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(timer)
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(async)
UV_HANDLE_PTR_INSTANTIATE_EXPLICIT(tty)
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 0e903c7..3eb293a 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -24,7 +24,7 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
// what is the variable name
auto const& envVarName = variable.substr(4, variable.size() - 5);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmSystemTools::UnsetEnv(envVarName.c_str());
#endif
return true;
diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx
index 2df3961..2060584 100644
--- a/Source/cm_codecvt.hxx
+++ b/Source/cm_codecvt.hxx
@@ -18,7 +18,7 @@ public:
ANSI
};
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
codecvt(Encoding e);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3cc6776..af73c8d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -31,7 +31,7 @@
#include "cm_string_view.hxx"
#include "cm_sys_stat.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_jsoncpp_writer.h"
# include "cmFileAPI.h"
@@ -40,11 +40,11 @@
# include <unordered_map>
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# define CMAKE_USE_ECLIPSE
#endif
-#if defined(__MINGW32__) && !defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(__MINGW32__) && defined(CMAKE_BOOTSTRAP)
# define CMAKE_BOOT_MINGW
#endif
@@ -72,7 +72,7 @@
# include "cmGlobalWatcomWMakeGenerator.h"
#endif
#include "cmGlobalUnixMakefileGenerator3.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmGlobalNinjaGenerator.h"
#endif
#include "cmExtraCodeLiteGenerator.h"
@@ -92,7 +92,7 @@
#endif
#if defined(__APPLE__)
-# if defined(CMAKE_BUILD_WITH_CMAKE)
+# if !defined(CMAKE_BOOTSTRAP)
# include "cmGlobalXCodeGenerator.h"
# define CMAKE_USE_XCODE 1
@@ -115,7 +115,7 @@
namespace {
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
#endif
@@ -134,7 +134,7 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
cmake::cmake(Role role, cmState::Mode mode)
: FileTimeCache(cm::make_unique<cmFileTimeCache>())
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
, VariableWatch(cm::make_unique<cmVariableWatch>())
#endif
, State(cm::make_unique<cmState>())
@@ -203,7 +203,7 @@ cmake::~cmake()
cmDeleteAll(this->Generators);
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value cmake::ReportVersionJson() const
{
Json::Value version = Json::objectValue;
@@ -262,7 +262,7 @@ Json::Value cmake::ReportCapabilitiesJson() const
std::string cmake::ReportCapabilities() const
{
std::string result;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::FastWriter writer;
result = writer.write(this->ReportCapabilitiesJson());
#else
@@ -968,7 +968,7 @@ int cmake::AddCMakePaths()
this->AddCacheEntry("CMAKE_COMMAND",
cmSystemTools::GetCMakeCommand().c_str(),
"Path to CMake executable.", cmStateEnums::INTERNAL);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->AddCacheEntry(
"CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
"Path to ctest program executable.", cmStateEnums::INTERNAL);
@@ -994,7 +994,7 @@ int cmake::AddCMakePaths()
void cmake::AddDefaultExtraGenerators()
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->ExtraGenerators.push_back(cmExtraCodeBlocksGenerator::GetFactory());
this->ExtraGenerators.push_back(cmExtraCodeLiteGenerator::GetFactory());
this->ExtraGenerators.push_back(cmExtraSublimeTextGenerator::GetFactory());
@@ -1521,7 +1521,7 @@ int cmake::ActualConfigure()
this->TruncateOutputLog("CMakeError.log");
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->FileAPI = cm::make_unique<cmFileAPI>(this);
this->FileAPI->ReadQueries();
#endif
@@ -1789,7 +1789,7 @@ int cmake::Generate()
// for the Visual Studio and Xcode generators.)
this->SaveCache(this->GetHomeOutputDirectory());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
this->FileAPI->WriteReplies();
#endif
@@ -1895,7 +1895,7 @@ void cmake::AddDefaultGenerators()
this->Generators.push_back(cmGlobalMinGWMakefileGenerator::NewFactory());
#endif
this->Generators.push_back(cmGlobalUnixMakefileGenerator3::NewFactory());
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# if defined(__linux__) || defined(_WIN32)
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
# endif
@@ -2054,7 +2054,7 @@ std::vector<cmDocumentationEntry> cmake::GetGeneratorsDocumentation()
void cmake::PrintGeneratorList()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDocumentation doc;
auto generators = this->GetGeneratorsDocumentation();
doc.AppendSection("Generators", generators);
@@ -2270,14 +2270,6 @@ void cmake::TruncateOutputLog(const char* fname)
}
}
-inline std::string removeQuotes(const std::string& s)
-{
- if (s.front() == '\"' && s.back() == '\"') {
- return s.substr(1, s.size() - 2);
- }
- return s;
-}
-
void cmake::MarkCliAsUsed(const std::string& variable)
{
this->UsedCliVariables[variable] = true;
@@ -2285,7 +2277,7 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const std::string& fileName) const
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmGraphVizWriter gvWriter(this->GetGlobalGenerator());
std::string settingsFile = this->GetHomeOutputDirectory();
@@ -2744,7 +2736,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
void cmake::WatchUnusedCli(const std::string& var)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this);
if (this->UsedCliVariables.find(var) == this->UsedCliVariables.end()) {
this->UsedCliVariables[var] = false;
@@ -2754,7 +2746,7 @@ void cmake::WatchUnusedCli(const std::string& var)
void cmake::UnwatchUnusedCli(const std::string& var)
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning);
this->UsedCliVariables.erase(var);
#endif
@@ -2762,7 +2754,7 @@ void cmake::UnwatchUnusedCli(const std::string& var)
void cmake::RunCheckForUnusedVariables()
{
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
bool haveUnused = false;
std::ostringstream msg;
msg << "Manually-specified variables were not used by the project:";
diff --git a/Source/cmake.h b/Source/cmake.h
index 92494ae..4c73519 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -20,7 +20,7 @@
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cm_jsoncpp_value.h"
#endif
@@ -145,7 +145,7 @@ public:
cmake(cmake const&) = delete;
cmake& operator=(cmake const&) = delete;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
Json::Value ReportVersionJson() const;
Json::Value ReportCapabilitiesJson() const;
#endif
@@ -334,7 +334,7 @@ public:
//! this is called by generators to update the progress
void UpdateProgress(const std::string& msg, float prog);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
//! Get the variable watch object
cmVariableWatch* GetVariableWatch() { return this->VariableWatch.get(); }
#endif
@@ -570,7 +570,7 @@ private:
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<cmVariableWatch> VariableWatch;
std::unique_ptr<cmFileAPI> FileAPI;
#endif
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index c96ccc7..74c0d0f 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -12,7 +12,7 @@
#include "cmake.h"
#include "cmcmd.h"
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
# include "cmDocumentation.h"
# include "cmDynamicLoader.h"
#endif
@@ -20,7 +20,7 @@
#include "cm_uv.h"
#include "cmsys/Encoding.hxx"
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
@@ -33,7 +33,7 @@
#include <vector>
namespace {
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
const char* cmDocumentationName[][2] = {
{ nullptr, " cmake - Cross-Platform Makefile Generator." },
{ nullptr, nullptr }
@@ -156,7 +156,7 @@ int do_cmake(int ac, char const* const* av)
return 1;
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDocumentation doc;
doc.addCMakeStandardDocSections();
if (doc.CheckOptions(ac, av)) {
@@ -339,7 +339,7 @@ int extract_job_number(int& index, char const* current, char const* next,
int do_build(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --build\n";
return -1;
#else
@@ -503,7 +503,7 @@ int do_build(int ac, char const* const* av)
int do_install(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --install\n";
return -1;
#else
@@ -624,7 +624,7 @@ int do_install(int ac, char const* const* av)
int do_open(int ac, char const* const* av)
{
-#ifndef CMAKE_BUILD_WITH_CMAKE
+#ifdef CMAKE_BOOTSTRAP
std::cerr << "This cmake does not support --open\n";
return -1;
#else
@@ -669,7 +669,7 @@ int do_open(int ac, char const* const* av)
int main(int ac, char const* const* av)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();
@@ -699,7 +699,7 @@ int main(int ac, char const* const* av)
}
}
int ret = do_cmake(ac, av);
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
uv_loop_close(uv_default_loop());
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index aecc978..69d5fcd 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -19,18 +19,18 @@
#include "cmVersion.h"
#include "cmake.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmServer.h"
# include "cmServerConnection.h"
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32)
# include "bindexplib.h"
# include "cmsys/ConsoleBuf.hxx"
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__)
# include "cmVisualStudioWCEPlatformParser.h"
#endif
@@ -61,7 +61,7 @@ void CMakeCommandUsage(const char* program)
{
std::ostringstream errorStream;
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
/* clang-format off */
errorStream
<< "cmake version " << cmVersion::GetCMakeVersion() << "\n";
@@ -561,7 +561,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 0;
}
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
else if (args[1] == "__create_def") {
if (args.size() < 4) {
std::cerr
@@ -654,7 +654,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
if (args[1] == "environment") {
for (auto const& env : cmSystemTools::GetEnvironmentVariables()) {
std::cout << env << std::endl;
@@ -994,7 +994,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return cmcmd::ExecuteLinkScript(args);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
// Internal CMake ninja dependency scanning support.
if (args[1] == "cmake_ninja_depends") {
return cmcmd_cmake_ninja_depends(args.begin() + 2, args.end());
@@ -1029,7 +1029,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return cmcmd::ExecuteEchoColor(args);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
+#ifndef CMAKE_BOOTSTRAP
if ((args[1] == "cmake_autogen") && (args.size() >= 4)) {
cmQtAutoMocUic autoGen;
std::string const& infoDir = args[2];
@@ -1210,7 +1210,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
cmConnection* conn;
if (isDebug) {
conn = new cmServerStdIoConnection;
@@ -1231,7 +1231,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return 1;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if !defined(CMAKE_BOOTSTRAP)
// Internal CMake Fortran module support.
if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4) {
return cmDependsFortran::CopyModule(args) ? 0 : 1;
@@ -1547,7 +1547,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string> const& args)
int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
+#if !defined(CMAKE_BOOTSTRAP) && defined(_WIN32) && !defined(__CYGWIN__)
cmVisualStudioWCEPlatformParser parser(name.c_str());
parser.ParseVersion(version);
if (parser.Found()) {
@@ -1605,7 +1605,7 @@ private:
// still works.
int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
{
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we output in the system codepage. CMake is set up
// to output in Unicode (see SetUTF8Pipes) but the Visual Studio linker
// outputs using the system codepage so we need to change behavior when
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 3b3630f..77a84fd 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -8,7 +8,7 @@
#include "cmSystemTools.h"
#include "cmsys/Encoding.hxx"
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
# include "cmsys/ConsoleBuf.hxx"
#endif
#include <iostream>
@@ -144,7 +144,7 @@ static const char* cmDocumentationOptions[][2] = {
int main(int argc, char const* const* argv)
{
cmSystemTools::EnsureStdPipes();
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
// Replace streambuf so we can output Unicode to console
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
consoleOut.SetUTF8Pipes();