cmExportPackageInfoGenerator: Fix -Wdeprecated-redundant-constexpr-static-def

In commit 3d52d70b84 (export: Add initial CPS support, 2024-07-26) we
added a static definition of a `constexpr` member to help older
AppleClang and SunPro linkers.  This is deprecated by C++17 and Clang
now warns about it, so preserving the approach would require complex
conditions. There is no significant benefit to `constexpr` here, so use
a traditional file-scoped definition instead.
This commit is contained in:
Brad King
2024-09-03 13:20:46 -04:00
parent b69cd358d5
commit 1650683c9d
2 changed files with 2 additions and 4 deletions

View File

@@ -26,7 +26,7 @@
#include "cmTarget.h"
#include "cmValue.h"
constexpr char const* cmExportPackageInfoGenerator::CPS_VERSION_STR;
static const std::string kCPS_VERSION_STR = "0.12.0";
cmExportPackageInfoGenerator::cmExportPackageInfoGenerator(
std::string packageName, std::string version, std::string versionCompat,
@@ -102,7 +102,7 @@ Json::Value cmExportPackageInfoGenerator::GeneratePackageInfo() const
Json::Value package;
package["name"] = this->GetPackageName();
package["cps_version"] = this->CPS_VERSION_STR;
package["cps_version"] = std::string(kCPS_VERSION_STR);
if (!this->PackageVersion.empty()) {
package["version"] = this->PackageVersion;

View File

@@ -111,6 +111,4 @@ private:
std::map<std::string, std::string> LinkTargets;
std::set<std::string> Requirements;
static constexpr char const* CPS_VERSION_STR = "0.12.0";
};