summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx7
-rw-r--r--Source/QtDialog/QCMake.cxx12
-rw-r--r--Source/QtDialog/QCMake.h4
-rw-r--r--Source/cmFindPackageCommand.cxx9
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx7
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx28
-rw-r--r--Source/cmGlobalXCodeGenerator.h7
-rw-r--r--Source/cmInstallTargetGenerator.cxx45
-rw-r--r--Source/cmQtAutoGenInitializer.cxx43
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx3
-rw-r--r--Source/cmQtAutoGeneratorRcc.cxx5
-rw-r--r--Source/cmSetCommand.cxx11
-rw-r--r--Source/cmState.cxx13
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmSystemTools.cxx4
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmake.cxx16
-rw-r--r--Source/cmake.h17
-rw-r--r--Source/kwsys/CMakeLists.txt25
-rw-r--r--Source/kwsys/kwsysPlatformTests.cmake5
23 files changed, 170 insertions, 101 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 9e64efa..3f37c95 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 13)
-set(CMake_VERSION_PATCH 20190130)
+set(CMake_VERSION_PATCH 20190131)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 38aa1b3..2fd4c7a 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -123,11 +123,8 @@ public:
s += "\n";
});
- cmSystemTools::SetStdoutCallback(
- [&s](const char* m, size_t len) { s.append(m, len); });
-
- cmSystemTools::SetStderrCallback(
- [&s](const char* m, size_t len) { s.append(m, len); });
+ cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
+ cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
s += msg;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 065d610..a073c30 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -29,9 +29,9 @@ QCMake::QCMake(QObject* p)
this->messageCallback(msg, title);
});
cmSystemTools::SetStdoutCallback(
- [this](const char* msg, size_t len) { this->stdoutCallback(msg, len); });
+ [this](std::string const& msg) { this->stdoutCallback(msg); });
cmSystemTools::SetStderrCallback(
- [this](const char* msg, size_t len) { this->stderrCallback(msg, len); });
+ [this](std::string const& msg) { this->stderrCallback(msg); });
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
this->CMakeInstance->SetCMakeEditCommand(
@@ -365,15 +365,15 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/)
QCoreApplication::processEvents();
}
-void QCMake::stdoutCallback(const char* msg, size_t len)
+void QCMake::stdoutCallback(std::string const& msg)
{
- emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
-void QCMake::stderrCallback(const char* msg, size_t len)
+void QCMake::stderrCallback(std::string const& msg)
{
- emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
+ emit this->outputMessage(QString::fromStdString(msg));
QCoreApplication::processEvents();
}
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 4f22505..ef4d2a1 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -170,8 +170,8 @@ protected:
bool interruptCallback();
void progressCallback(const char* msg, float percent);
void messageCallback(const char* msg, const char* title);
- void stdoutCallback(const char* msg, size_t len);
- void stderrCallback(const char* msg, size_t len);
+ void stdoutCallback(std::string const& msg);
+ void stderrCallback(std::string const& msg);
bool WarnUninitializedMode;
bool WarnUnusedMode;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index f9ac310..c2e0712 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -693,7 +693,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
std::string var = this->Name;
var += "_FIND_MODULE";
this->Makefile->AddDefinition(var, "1");
- bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope);
+ bool result = this->ReadListFile(mfile, DoPolicyScope);
this->Makefile->RemoveDefinition(var);
return result;
}
@@ -776,7 +776,7 @@ bool cmFindPackageCommand::HandlePackageMode()
this->StoreVersionFound();
// Parse the configuration file.
- if (this->ReadListFile(this->FileFound.c_str(), DoPolicyScope)) {
+ if (this->ReadListFile(this->FileFound, DoPolicyScope)) {
// The package has been found.
found = true;
@@ -1036,7 +1036,8 @@ bool cmFindPackageCommand::FindAppBundleConfig()
return false;
}
-bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
+bool cmFindPackageCommand::ReadListFile(const std::string& f,
+ PolicyScopeRule psr)
{
const bool noPolicyScope = !this->PolicyScope || psr == NoPolicyScope;
if (this->Makefile->ReadDependentFile(f, noPolicyScope)) {
@@ -1590,7 +1591,7 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file,
// Load the version check file. Pass NoPolicyScope because we do
// our own policy push/pop independent of CMP0011.
bool suitable = false;
- if (this->ReadListFile(version_file.c_str(), NoPolicyScope)) {
+ if (this->ReadListFile(version_file, NoPolicyScope)) {
// Check the output variables.
bool okay = this->Makefile->IsOn("PACKAGE_VERSION_EXACT");
bool unsuitable = this->Makefile->IsOn("PACKAGE_VERSION_UNSUITABLE");
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 83d8431..a11d253 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -110,7 +110,7 @@ private:
NoPolicyScope,
DoPolicyScope
};
- bool ReadListFile(const char* f, PolicyScopeRule psr);
+ bool ReadListFile(const std::string& f, PolicyScopeRule psr);
void StoreVersionFound();
void ComputePrefixes();
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index eb66ed5..aac188e 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -95,7 +95,7 @@ static const struct ZeroNode installInterfaceNode;
#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \
static const struct OP##Node : public cmGeneratorExpressionNode \
{ \
- OP##Node() {} \
+ OP##Node() {} /* NOLINT(modernize-use-equals-default) */ \
virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \
\
std::string Evaluate(const std::vector<std::string>& parameters, \
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 86f10dc..78040c3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3859,6 +3859,13 @@ std::string cmGeneratorTarget::GetObjectDirectory(
// find and replace $(PROJECT_NAME) xcode placeholder
const std::string projectName = this->LocalGenerator->GetProjectName();
cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName);
+ // Replace Xcode's placeholder for the object file directory since
+ // installation and export scripts need to know the real directory.
+ // Xcode has build-time settings (e.g. for sanitizers) that affect this,
+ // but we use the default here. Users that want to enable sanitizers
+ // will do so at the cost of object library installation and export.
+ cmSystemTools::ReplaceString(obj_dir, "$(OBJECT_FILE_DIR_normal:base)",
+ "Objects-normal");
#endif
return obj_dir;
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9c0c18b..f1b32ee 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -485,6 +485,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
}
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
+#define OBJECT_LIBRARY_ARTIFACT_DIR std::string()
void cmGlobalXCodeGenerator::AddExtraTargets(
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens)
@@ -509,6 +510,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
makeHelper.push_back(dir);
makeHelper.push_back("-f");
makeHelper.push_back(this->CurrentXCodeHackMakefile);
+ makeHelper.push_back("OBJDIR=$(OBJDIR)");
makeHelper.push_back(""); // placeholder, see below
// Add ZERO_CHECK
@@ -1664,6 +1666,7 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
makecmd += cdir;
makecmd += " -f ";
makecmd += this->ConvertToRelativeForMake((makefile + "$CONFIGURATION"));
+ makecmd += " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\")";
makecmd += " all";
buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
@@ -1971,8 +1974,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
pnbase = gtgt->GetName();
pnsuffix = ".a";
- std::string pncdir =
- this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt);
+ std::string pncdir = this->GetObjectsDirectory(
+ this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR);
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
this->CreateString(pncdir));
}
@@ -3202,9 +3205,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
return true;
}
-std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
+std::string cmGlobalXCodeGenerator::GetObjectsDirectory(
const std::string& projName, const std::string& configName,
- const cmGeneratorTarget* t) const
+ const cmGeneratorTarget* t, const std::string& variant) const
{
std::string dir = t->GetLocalGenerator()->GetCurrentBinaryDirectory();
dir += "/";
@@ -3213,8 +3216,8 @@ std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
dir += configName;
dir += "/";
dir += t->GetName();
- dir += ".build/Objects-normal/";
-
+ dir += ".build/";
+ dir += variant;
return dir;
}
@@ -3341,8 +3344,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
for (auto objLib : objlibs) {
const std::string objLibName = objLib->GetName();
- std::string d = this->GetObjectsNormalDirectory(this->CurrentProject,
- configName, objLib);
+ std::string d =
+ this->GetObjectsDirectory(this->CurrentProject, configName, objLib,
+ OBJECT_LIBRARY_ARTIFACT_DIR);
d += "lib";
d += objLibName;
d += ".a";
@@ -3359,8 +3363,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
// if building for more than one architecture
// then remove those executables as well
if (this->Architectures.size() > 1) {
- std::string universal = this->GetObjectsNormalDirectory(
- this->CurrentProject, configName, gt);
+ std::string universal = this->GetObjectsDirectory(
+ this->CurrentProject, configName, gt, "$(OBJDIR)/");
for (const auto& architecture : this->Architectures) {
std::string universalFile = universal;
universalFile += architecture;
@@ -3764,8 +3768,8 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
cmGeneratorTarget* gt) const
{
std::string configName = this->GetCMakeCFGIntDir();
- std::string dir =
- this->GetObjectsNormalDirectory("$(PROJECT_NAME)", configName, gt);
+ std::string dir = this->GetObjectsDirectory(
+ "$(PROJECT_NAME)", configName, gt, "$(OBJECT_FILE_DIR_normal:base)/");
dir += this->ObjectDirArch;
dir += "/";
gt->ObjectDirectory = dir;
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 92ff258..e1e412d 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -264,9 +264,10 @@ private:
{
}
- std::string GetObjectsNormalDirectory(const std::string& projName,
- const std::string& configName,
- const cmGeneratorTarget* t) const;
+ std::string GetObjectsDirectory(const std::string& projName,
+ const std::string& configName,
+ const cmGeneratorTarget* t,
+ const std::string& variant) const;
static std::string GetDeploymentPlatform(const cmMakefile* mf);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 10df70b..59701a1 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string targetName, const char* dest, bool implib,
@@ -209,8 +210,34 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
// An import library looks like a static library.
type = cmInstallType_STATIC_LIBRARY;
} else if (this->Target->IsFrameworkOnApple()) {
- // There is a bug in cmInstallCommand if this fails.
- assert(this->NamelinkMode == NamelinkModeNone);
+ // FIXME: In principle we should be able to
+ // assert(this->NamelinkMode == NamelinkModeNone);
+ // but since the current install() command implementation checks
+ // the FRAMEWORK property immediately instead of delaying until
+ // generate time, it is possible for project code to set the
+ // property after calling install(). In such a case, the install()
+ // command will use the LIBRARY code path and create two install
+ // generators, one for the namelink component (NamelinkModeOnly)
+ // and one for the primary artifact component (NamelinkModeSkip).
+ // Historically this was not diagnosed and resulted in silent
+ // installation of a framework to the LIBRARY destination.
+ // Retain that behavior and warn about the case.
+ switch (this->NamelinkMode) {
+ case NamelinkModeNone:
+ // Normal case.
+ break;
+ case NamelinkModeOnly:
+ // Assume the NamelinkModeSkip instance will warn and install.
+ return;
+ case NamelinkModeSkip: {
+ std::string e = "Target '" + this->Target->GetName() +
+ "' was changed to a FRAMEWORK sometime after install(). "
+ "This may result in the wrong install DESTINATION. "
+ "Set the FRAMEWORK property earlier.";
+ this->Target->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage(
+ MessageType::AUTHOR_WARNING, e, this->GetBacktrace());
+ } break;
+ }
// Install the whole framework directory.
type = cmInstallType_DIRECTORY;
@@ -765,10 +792,22 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
return;
}
+ std::string stripArgs;
+
+ // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'.
+ if (this->Target->Target->GetMakefile()->IsOn("APPLE")) {
+ if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
+ stripArgs = "-x ";
+ } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE) {
+ stripArgs = "-u -r ";
+ }
+ }
+
os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
os << indent << " execute_process(COMMAND \""
<< this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
- << "\" \"" << toDestDirPath << "\")\n";
+ << "\" " << stripArgs << "\"" << toDestDirPath << "\")\n";
os << indent << "endif()\n";
}
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 1d7f6d1..caeed15 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1370,7 +1370,7 @@ void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
this->Target->AddSource(filename, prepend);
}
-static unsigned int CharPtrToInt(const char* const input)
+static unsigned int CharPtrToUInt(const char* const input)
{
unsigned long tmp = 0;
if (input != nullptr && cmSystemTools::StringToULong(input, &tmp)) {
@@ -1379,36 +1379,43 @@ static unsigned int CharPtrToInt(const char* const input)
return 0;
}
-static unsigned int StringToInt(const std::string& input)
-{
- return input.empty() ? 0 : CharPtrToInt(input.c_str());
-}
-
-static std::vector<cmQtAutoGenInitializer::IntegerVersion> GetKnownQtVersions(
+static std::vector<cmQtAutoGen::IntegerVersion> GetKnownQtVersions(
cmGeneratorTarget const* target)
{
cmMakefile* makefile = target->Target->GetMakefile();
-
- std::vector<cmQtAutoGenInitializer::IntegerVersion> result;
- for (const std::string& prefix :
- std::vector<std::string>({ "Qt6Core", "Qt5Core", "QT" })) {
- auto tmp = cmQtAutoGenInitializer::IntegerVersion(
- StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")),
- StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR")));
- if (tmp.Major != 0) {
- result.push_back(tmp);
+ std::vector<cmQtAutoGen::IntegerVersion> result;
+ // Adds a version to the result (nullptr safe)
+ auto addVersion = [&result](const char* major, const char* minor) {
+ cmQtAutoGen::IntegerVersion ver(CharPtrToUInt(major),
+ CharPtrToUInt(minor));
+ if (ver.Major != 0) {
+ result.emplace_back(ver);
}
+ };
+ // Qt version variable prefixes
+ std::array<std::string, 3> const prefixes{ { "Qt6Core", "Qt5Core", "QT" } };
+
+ // Read versions from variables
+ for (const std::string& prefix : prefixes) {
+ addVersion(makefile->GetDefinition(prefix + "_VERSION_MAJOR"),
+ makefile->GetDefinition(prefix + "_VERSION_MINOR"));
+ }
+
+ // Read versions from directory properties
+ for (const std::string& prefix : prefixes) {
+ addVersion(makefile->GetProperty(prefix + "_VERSION_MAJOR"),
+ makefile->GetProperty(prefix + "_VERSION_MINOR"));
}
return result;
}
-std::pair<cmQtAutoGenInitializer::IntegerVersion, unsigned int>
+std::pair<cmQtAutoGen::IntegerVersion, unsigned int>
cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target)
{
std::pair<IntegerVersion, unsigned int> res(
IntegerVersion(),
- CharPtrToInt(target->GetLinkInterfaceDependentStringProperty(
+ CharPtrToUInt(target->GetLinkInterfaceDependentStringProperty(
"QT_MAJOR_VERSION", "")));
auto knownQtVersions = GetKnownQtVersions(target);
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index bc496ac..0ba5224 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1111,8 +1111,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessStart(uv_async_t* handle)
{
std::lock_guard<std::mutex> lock(wrk.ProcessMutex_);
if (wrk.Process_ && !wrk.Process_->IsStarted()) {
- wrk.Process_->start(handle->loop,
- std::bind(&WorkerT::UVProcessFinished, &wrk));
+ wrk.Process_->start(handle->loop, [&wrk] { wrk.UVProcessFinished(); });
}
}
}
diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx
index 43ff172..021a15f 100644
--- a/Source/cmQtAutoGeneratorRcc.cxx
+++ b/Source/cmQtAutoGeneratorRcc.cxx
@@ -10,8 +10,6 @@
#include "cmSystemTools.h"
#include "cmUVHandlePtr.h"
-#include <functional>
-
// -- Class methods
cmQtAutoGeneratorRcc::cmQtAutoGeneratorRcc()
@@ -662,8 +660,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
Process_ = cm::make_unique<ReadOnlyProcessT>();
Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory);
// Start process
- if (!Process_->start(UVLoop(),
- std::bind(&cm::uv_async_ptr::send, &UVRequest()))) {
+ if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) {
Log().ErrorFile(GeneratorT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
Error_ = true;
// Clean up
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 1a2d1c6..b09e3ca 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
@@ -112,7 +113,15 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
if (cache) {
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
- type = cmState::StringToCacheEntryType(args[cacheStart + 1].c_str());
+ if (!cmState::StringToCacheEntryType(args[cacheStart + 1].c_str(), type)) {
+ std::string m = "implicitly converting '" + args[cacheStart + 1] +
+ "' to 'STRING' type.";
+ this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m);
+ // Setting this may not be required, since it's
+ // initialized as a string. Keeping this here to
+ // ensure that the type is actually converting to a string.
+ type = cmStateEnums::STRING;
+ }
docstring = args[cacheStart + 2].c_str();
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index fdd7b3d..a08e9b8 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -75,14 +75,23 @@ const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type)
cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s)
{
+ cmStateEnums::CacheEntryType type = cmStateEnums::STRING;
+ StringToCacheEntryType(s, type);
+ return type;
+}
+
+bool cmState::StringToCacheEntryType(const char* s,
+ cmStateEnums::CacheEntryType& type)
+{
int i = 0;
while (cmCacheEntryTypes[i]) {
if (strcmp(s, cmCacheEntryTypes[i]) == 0) {
- return static_cast<cmStateEnums::CacheEntryType>(i);
+ type = static_cast<cmStateEnums::CacheEntryType>(i);
+ return true;
}
++i;
}
- return cmStateEnums::STRING;
+ return false;
}
bool cmState::IsCacheEntryType(std::string const& key)
diff --git a/Source/cmState.h b/Source/cmState.h
index e447485..f755f83 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -65,6 +65,8 @@ public:
cmStateSnapshot Pop(cmStateSnapshot const& originSnapshot);
static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*);
+ static bool StringToCacheEntryType(const char*,
+ cmStateEnums::CacheEntryType& type);
static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType);
static bool IsCacheEntryType(std::string const& key);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a9cf0c6..5d8c079 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -308,7 +308,7 @@ void cmSystemTools::SetStderrCallback(OutputCallback f)
void cmSystemTools::Stderr(const std::string& s)
{
if (s_StderrCallback) {
- s_StderrCallback(s.c_str(), s.length());
+ s_StderrCallback(s);
} else {
std::cerr << s << std::flush;
}
@@ -317,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s)
void cmSystemTools::Stdout(const std::string& s)
{
if (s_StdoutCallback) {
- s_StdoutCallback(s.c_str(), s.length());
+ s_StdoutCallback(s);
} else {
std::cout << s << std::flush;
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index a6f68d3..fcb2cce 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -80,7 +80,7 @@ public:
Message(m.c_str(), title);
}
- using OutputCallback = std::function<void(const char*, size_t)>;
+ using OutputCallback = std::function<void(std::string const&)>;
///! Send a string to stdout
static void Stdout(const std::string& s);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2b627ff..8023298 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -437,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
std::cout << "loading initial cache file " << path << "\n";
- this->ReadListFile(args, path.c_str());
+ this->ReadListFile(args, path);
} else if (arg.find("-P", 0) == 0) {
i++;
if (i >= args.size()) {
@@ -451,7 +451,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// Register fake project commands that hint misuse in script mode.
GetProjectCommandsInScriptMode(this->State);
- this->ReadListFile(args, path.c_str());
+ this->ReadListFile(args, path);
} else if (arg.find("--find-package", 0) == 0) {
findPackageMode = true;
}
@@ -465,7 +465,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
void cmake::ReadListFile(const std::vector<std::string>& args,
- const char* path)
+ const std::string& path)
{
// if a generator was not yet created, temporarily create one
cmGlobalGenerator* gg = this->GetGlobalGenerator();
@@ -478,7 +478,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
}
// read in the list file to fill the cache
- if (path) {
+ if (!path.empty()) {
this->CurrentSnapshot = this->State->Reset();
std::string homeDir = this->GetHomeDirectory();
std::string homeOutputDir = this->GetHomeOutputDirectory();
@@ -499,7 +499,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
mf.SetArgcArgv(args);
}
if (!mf.ReadListFile(path)) {
- cmSystemTools::Error("Error processing file: ", path);
+ cmSystemTools::Error("Error processing file: " + path);
}
this->SetHomeDirectory(homeDir);
this->SetHomeOutputDirectory(homeOutputDir);
@@ -1606,14 +1606,14 @@ void cmake::PreLoadCMakeFiles()
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
- this->ReadListFile(args, pre_load.c_str());
+ this->ReadListFile(args, pre_load);
}
}
pre_load = this->GetHomeOutputDirectory();
if (!pre_load.empty()) {
pre_load += "/PreLoad.cmake";
if (cmSystemTools::FileExists(pre_load)) {
- this->ReadListFile(args, pre_load.c_str());
+ this->ReadListFile(args, pre_load);
}
}
}
@@ -2613,7 +2613,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
cachePath + "/" + "CMakeFiles/" + "VerifyGlobs.cmake";
if (cmSystemTools::FileExists(globVerifyScript)) {
std::vector<std::string> args;
- this->ReadListFile(args, globVerifyScript.c_str());
+ this->ReadListFile(args, globVerifyScript);
}
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 314101e..53d44f1 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -444,7 +444,6 @@ public:
protected:
void RunCheckForUnusedVariables();
- void InitializeProperties();
int HandleDeleteCacheVariables(const std::string& var);
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
@@ -464,7 +463,8 @@ protected:
std::string GeneratorToolset;
///! read in a cmake list file to initialize the cache
- void ReadListFile(const std::vector<std::string>& args, const char* path);
+ void ReadListFile(const std::vector<std::string>& args,
+ const std::string& path);
bool FindPackage(const std::vector<std::string>& args);
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
@@ -487,7 +487,6 @@ protected:
private:
ProgressCallbackType ProgressCallback;
- bool InTryCompile;
WorkingMode CurrentWorkingMode;
bool DebugOutput;
bool Trace;
@@ -535,18 +534,6 @@ private:
void AppendGlobalGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
void AppendExtraGeneratorsDocumentation(std::vector<cmDocumentationEntry>&);
-
- /**
- * Convert a message type between a warning and an error, based on the state
- * of the error output CMake variables, in the cache.
- */
- MessageType ConvertMessageType(MessageType t) const;
-
- /*
- * Check if messages of this type should be output, based on the state of the
- * warning and error output CMake variables, in the cache.
- */
- bool IsMessageTypeVisible(MessageType t) const;
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index b33aa80..e7da994 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -42,6 +42,10 @@
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
#
+# KWSYS_CXX_STANDARD = A value for CMAKE_CXX_STANDARD within KWSys.
+# Set to empty string to use no default value.
+# KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys.
+#
# Optional settings to setup install rules are as follows:
#
# KWSYS_INSTALL_BIN_DIR = The installation target directories into
@@ -82,25 +86,17 @@
# any outside mailing list and no documentation of the change will be
# written.
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR)
FOREACH(p
- CMP0022 # CMake 2.8, Define link interface - required by android_mk export
- CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang.
- CMP0042 # CMake 3.0, MACOSX_RPATH is enabled by default.
- CMP0048 # CMake 3.0, Let the project command manage version variables.
CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature.
CMP0063 # CMake 3.3, Honor visibility properties for all target types.
+ CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature.
CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
)
IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW)
ENDIF()
ENDFOREACH()
-SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
-
-IF(CMAKE_VERSION VERSION_LESS 3.0)
- SET(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE 0)
-ENDIF()
#-----------------------------------------------------------------------------
# If a namespace is not specified, use "kwsys" and enable testing.
@@ -121,6 +117,12 @@ SET_PROPERTY(DIRECTORY
"KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>"
)
+if(KWSYS_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD "${KWSYS_CXX_STANDARD}")
+elseif(NOT DEFINED CMAKE_CXX_STANDARD AND NOT DEFINED KWSYS_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 11)
+endif()
+
# Select library components.
IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_ENABLE_C 1)
@@ -884,6 +886,8 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
${KWSYS_TARGET_INTERFACE})
TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE
$<TARGET_OBJECTS:${KWSYS_TARGET_OBJECT}>)
+ target_compile_features(${KWSYS_TARGET_OBJECT} PRIVATE ${KWSYS_CXX_COMPILE_FEATURES})
+ target_compile_features(${KWSYS_TARGET_INTERFACE} INTERFACE ${KWSYS_CXX_COMPILE_FEATURES})
ELSE()
SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE})
SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE})
@@ -892,6 +896,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
SET(KWSYS_LINK_DEPENDENCY PUBLIC)
ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE}
${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS})
+ target_compile_features(${KWSYS_TARGET_INTERFACE} PUBLIC ${KWSYS_CXX_COMPILE_FEATURES})
ENDIF()
if (KWSYS_ALIAS_TARGET)
add_library(${KWSYS_ALIAS_TARGET} ALIAS ${KWSYS_TARGET_INTERFACE})
diff --git a/Source/kwsys/kwsysPlatformTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake
index 5386a49..28d3f68 100644
--- a/Source/kwsys/kwsysPlatformTests.cmake
+++ b/Source/kwsys/kwsysPlatformTests.cmake
@@ -7,11 +7,16 @@ SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx)
MACRO(KWSYS_PLATFORM_TEST lang var description invert)
IF(NOT DEFINED ${var}_COMPILED)
MESSAGE(STATUS "${description}")
+ set(maybe_cxx_standard "")
+ if(CMAKE_VERSION VERSION_LESS 3.8 AND CMAKE_CXX_STANDARD)
+ set(maybe_cxx_standard "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
+ endif()
TRY_COMPILE(${var}_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS}
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${KWSYS_PLATFORM_TEST_LINK_LIBRARIES}"
+ ${maybe_cxx_standard}
OUTPUT_VARIABLE OUTPUT)
IF(${var}_COMPILED)
FILE(APPEND