summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindThreads.cmake45
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCPluginAPI.cxx3
-rw-r--r--Source/cmCacheManager.cxx3
-rw-r--r--Source/cmExportFileGenerator.cxx12
-rw-r--r--Source/cmMakefileProfilingData.cxx15
-rw-r--r--Source/cmPropertyMap.cxx10
-rw-r--r--Source/cmPropertyMap.h4
-rw-r--r--Source/cmSourceFile.cxx5
-rw-r--r--Source/cmState.cxx3
-rw-r--r--Source/cmStateDirectory.cxx4
-rw-r--r--Source/cmStateSnapshot.cxx5
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTest.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
15 files changed, 73 insertions, 52 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 85174d9..f97e5c8 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -7,31 +7,44 @@ FindThreads
This module determines the thread library of the system.
-The following variables are set
+Imported Targets
+^^^^^^^^^^^^^^^^
-::
+This module defines the following :prop_tgt:`IMPORTED` target:
- CMAKE_THREAD_LIBS_INIT - the thread library
- CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
- CMAKE_USE_PTHREADS_INIT - are we using pthreads
- CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
+``Threads::Threads``
+ The thread library, if found.
-The following import target is created
+Result Variables
+^^^^^^^^^^^^^^^^
-::
+The following variables are set:
- Threads::Threads
+``Threads_FOUND``
+ If a supported thread library was found.
+``CMAKE_THREAD_LIBS_INIT``
+ The thread library to use. This may be empty if the thread functions
+ are provided by the system libraries and no special flags are needed
+ to use them.
+``CMAKE_USE_WIN32_THREADS_INIT``
+ If the found thread library is the win32 one.
+``CMAKE_USE_PTHREADS_INIT``
+ If the found thread library is pthread compatible.
+``CMAKE_HP_PTHREADS_INIT``
+ If the found thread library is the HP thread library.
-If the use of the -pthread compiler and linker flag is preferred then the
-caller can set
+Variables Affecting Behavior
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-::
+.. variable:: THREADS_PREFER_PTHREAD_FLAG
- THREADS_PREFER_PTHREAD_FLAG
+ If the use of the -pthread compiler and linker flag is preferred then
+ the caller can set this variable to TRUE. The compiler flag can only be
+ used with the imported target. Use of both the imported target as well
+ as this switch is highly recommended for new code.
-The compiler flag can only be used with the imported
-target. Use of both the imported target as well as this switch is highly
-recommended for new code.
+ This variable has no effect if the system libraries provide the
+ thread functions, i.e. when ``CMAKE_THREAD_LIBS_INIT`` will be empty.
#]=======================================================================]
include (CheckLibraryExists)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index edbac48..d68a4c9 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 17)
-set(CMake_VERSION_PATCH 20200316)
+set(CMake_VERSION_PATCH 20200317)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 80441be..874efa5 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -585,7 +585,8 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
if (!strcmp(prop, "LOCATION")) {
return sf->FullPath.c_str();
}
- return sf->Properties.GetPropertyValue(prop);
+ cmProp retVal = sf->Properties.GetPropertyValue(prop);
+ return retVal ? retVal->c_str() : nullptr;
}
int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index dc9aba1..ee89b0d 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -628,7 +628,8 @@ const char* cmCacheManager::CacheEntry::GetProperty(
if (prop == "VALUE") {
return this->Value.c_str();
}
- return this->Properties.GetPropertyValue(prop);
+ cmProp retVal = this->Properties.GetPropertyValue(prop);
+ return retVal ? retVal->c_str() : nullptr;
}
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index bbae86c..003019a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1215,9 +1215,9 @@ bool cmExportFileGenerator::PopulateExportProperties(
std::string& errorMessage)
{
auto& targetProperties = gte->Target->GetProperties();
- if (const char* exportProperties =
+ if (cmProp exportProperties =
targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
- for (auto& prop : cmExpandedList(exportProperties)) {
+ for (auto& prop : cmExpandedList(*exportProperties)) {
/* Black list reserved properties */
if (cmHasLiteralPrefix(prop, "IMPORTED_") ||
cmHasLiteralPrefix(prop, "INTERFACE_")) {
@@ -1228,15 +1228,15 @@ bool cmExportFileGenerator::PopulateExportProperties(
errorMessage = e.str();
return false;
}
- auto propertyValue = targetProperties.GetPropertyValue(prop);
+ cmProp propertyValue = targetProperties.GetPropertyValue(prop);
if (propertyValue == nullptr) {
// Asked to export a property that isn't defined on the target. Do not
// consider this an error, there's just nothing to export.
continue;
}
std::string evaluatedValue = cmGeneratorExpression::Preprocess(
- propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
- if (evaluatedValue != propertyValue) {
+ *propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions);
+ if (evaluatedValue != *propertyValue) {
std::ostringstream e;
e << "Target \"" << gte->Target->GetName() << "\" contains property \""
<< prop << "\" in EXPORT_PROPERTIES but this property contains a "
@@ -1244,7 +1244,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
errorMessage = e.str();
return false;
}
- properties[prop] = propertyValue;
+ properties[prop] = *propertyValue;
}
}
return true;
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index ea64132..adf4eee 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -3,7 +3,6 @@
#include "cmMakefileProfilingData.h"
#include <chrono>
-#include <cstdint>
#include <stdexcept>
#include <vector>
@@ -61,9 +60,10 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
v["ph"] = "B";
v["name"] = lff.Name.Original;
v["cat"] = "cmake";
- v["ts"] = uint64_t(std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::steady_clock::now().time_since_epoch())
- .count());
+ v["ts"] = Json::Value::UInt64(
+ std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count());
v["pid"] = static_cast<int>(info.GetProcessId());
v["tid"] = 0;
Json::Value argsValue;
@@ -98,9 +98,10 @@ void cmMakefileProfilingData::StopEntry()
cmsys::SystemInformation info;
Json::Value v;
v["ph"] = "E";
- v["ts"] = uint64_t(std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::steady_clock::now().time_since_epoch())
- .count());
+ v["ts"] = Json::Value::UInt64(
+ std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count());
v["pid"] = static_cast<int>(info.GetProcessId());
v["tid"] = 0;
this->JsonWriter->write(v, &this->ProfileStream);
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index d4b3552..f22f36d 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -42,13 +42,11 @@ void cmPropertyMap::RemoveProperty(const std::string& name)
Map_.erase(name);
}
-const char* cmPropertyMap::GetPropertyValue(const std::string& name) const
+cmProp cmPropertyMap::GetPropertyValue(const std::string& name) const
{
- {
- auto it = Map_.find(name);
- if (it != Map_.end()) {
- return it->second.c_str();
- }
+ auto it = Map_.find(name);
+ if (it != Map_.end()) {
+ return &it->second;
}
return nullptr;
}
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index bea4372..40ac356 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -10,6 +10,8 @@
#include <utility>
#include <vector>
+using cmProp = const std::string*;
+
/** \class cmPropertyMap
* \brief String property map.
*/
@@ -31,7 +33,7 @@ public:
bool asString = false);
//! Get the property value
- const char* GetPropertyValue(const std::string& name) const;
+ cmProp GetPropertyValue(const std::string& name) const;
//! Remove the property @a name from the map
void RemoveProperty(const std::string& name);
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index fd9cacd..5dc8b05 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -361,7 +361,7 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
return output.c_str();
}
- const char* retVal = this->Properties.GetPropertyValue(prop);
+ cmProp retVal = this->Properties.GetPropertyValue(prop);
if (!retVal) {
cmMakefile const* mf = this->Location.GetMakefile();
const bool chain =
@@ -369,9 +369,10 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
if (chain) {
return mf->GetProperty(prop, chain);
}
+ return nullptr;
}
- return retVal;
+ return retVal->c_str();
}
const char* cmSourceFile::GetSafeProperty(const std::string& prop) const
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 51e4976..f424afa 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -625,7 +625,8 @@ const char* cmState::GetGlobalProperty(const std::string& prop)
}
#undef STRING_LIST_ELEMENT
- return this->GlobalProperties.GetPropertyValue(prop);
+ cmProp retVal = this->GlobalProperties.GetPropertyValue(prop);
+ return retVal ? retVal->c_str() : nullptr;
}
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 4f003ed..e7de3c7 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -634,7 +634,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
return output.c_str();
}
- const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
+ cmProp retVal = this->DirectoryState->Properties.GetPropertyValue(prop);
if (!retVal && chain) {
cmStateSnapshot parentSnapshot =
this->Snapshot_.GetBuildsystemDirectoryParent();
@@ -644,7 +644,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop,
return this->Snapshot_.State->GetGlobalProperty(prop);
}
- return retVal;
+ return retVal ? retVal->c_str() : nullptr;
}
bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 832e74e..d79df6f 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -411,11 +411,12 @@ void cmStateSnapshot::InitializeFromParent()
this->Position->BuildSystemDirectory->LinkDirectoriesBacktraces,
this->Position->LinkDirectoriesPosition);
- const char* include_regex =
+ cmProp include_regex =
parent->BuildSystemDirectory->Properties.GetPropertyValue(
"INCLUDE_REGULAR_EXPRESSION");
this->Position->BuildSystemDirectory->Properties.SetProperty(
- "INCLUDE_REGULAR_EXPRESSION", include_regex);
+ "INCLUDE_REGULAR_EXPRESSION",
+ include_regex ? include_regex->c_str() : nullptr);
}
cmState* cmStateSnapshot::GetState() const
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7af0edd..f92eea4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1773,7 +1773,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const
}
}
- const char* retVal = impl->Properties.GetPropertyValue(prop);
+ cmProp retVal = impl->Properties.GetPropertyValue(prop);
if (!retVal) {
const bool chain =
impl->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TARGET);
@@ -1781,8 +1781,9 @@ const char* cmTarget::GetProperty(const std::string& prop) const
return impl->Makefile->GetStateSnapshot().GetDirectory().GetProperty(
prop, chain);
}
+ return nullptr;
}
- return retVal;
+ return retVal->c_str();
}
const char* cmTarget::GetSafeProperty(const std::string& prop) const
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 3b731cc..56c441a 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -34,15 +34,16 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
const char* cmTest::GetProperty(const std::string& prop) const
{
- const char* retVal = this->Properties.GetPropertyValue(prop);
+ cmProp retVal = this->Properties.GetPropertyValue(prop);
if (!retVal) {
const bool chain =
this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
if (chain) {
return this->Makefile->GetProperty(prop, chain);
}
+ return nullptr;
}
- return retVal;
+ return retVal->c_str();
}
bool cmTest::GetPropertyAsBool(const std::string& prop) const
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 121ff6e..6f5d813 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1017,7 +1017,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
if (p.find(propNamePrefix) == 0) {
std::string tagName = p.substr(propNamePrefix.length());
if (!tagName.empty()) {
- std::string value = props.GetPropertyValue(p);
+ const std::string& value = *props.GetPropertyValue(p);
if (!value.empty()) {
e2.Element(tagName, value);
}
@@ -4802,7 +4802,7 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
if (p.find(propNamePrefix) == 0) {
std::string tagName = p.substr(propNamePrefix.length());
if (!tagName.empty()) {
- const std::string val = props.GetPropertyValue(p);
+ const std::string& val = *props.GetPropertyValue(p);
if (!val.empty()) {
tags[tagName] = val;
} else {