summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-25 13:23:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-01-25 13:24:03 (GMT)
commit80eac951725c1d54346e545f997a5b4b90380af1 (patch)
treee4664d216dbf56e6b13aa50c9d9bf90c6f95d2f4
parent3bcb07c7de5073da9562527394e469cca709d9e7 (diff)
parentbfacb491546fa56778606f0acd7599cdd481cef1 (diff)
downloadCMake-80eac951725c1d54346e545f997a5b4b90380af1.zip
CMake-80eac951725c1d54346e545f997a5b4b90380af1.tar.gz
CMake-80eac951725c1d54346e545f997a5b4b90380af1.tar.bz2
Merge topic 'fileapi-defer-static-init'
bfacb49154 fileapi: Make internal "toolchains" field tables more local Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6894
-rw-r--r--Source/cmFileAPIToolchains.cxx41
1 files changed, 19 insertions, 22 deletions
diff --git a/Source/cmFileAPIToolchains.cxx b/Source/cmFileAPIToolchains.cxx
index b3540c9..fe2972f 100644
--- a/Source/cmFileAPIToolchains.cxx
+++ b/Source/cmFileAPIToolchains.cxx
@@ -30,10 +30,6 @@ class Toolchains
cmFileAPI& FileAPI;
unsigned long Version;
- static const std::vector<ToolchainVariable> CompilerVariables;
- static const std::vector<ToolchainVariable> CompilerImplicitVariables;
- static const ToolchainVariable SourceFileExtensionsVariable;
-
Json::Value DumpToolchains();
Json::Value DumpToolchain(std::string const& lang);
Json::Value DumpToolchainVariables(
@@ -48,24 +44,6 @@ public:
Json::Value Dump();
};
-const std::vector<ToolchainVariable> Toolchains::CompilerVariables{
- { "path", "COMPILER", false },
- { "id", "COMPILER_ID", false },
- { "version", "COMPILER_VERSION", false },
- { "target", "COMPILER_TARGET", false },
-};
-
-const std::vector<ToolchainVariable> Toolchains::CompilerImplicitVariables{
- { "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true },
- { "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true },
- { "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", true },
- { "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true },
-};
-
-const ToolchainVariable Toolchains::SourceFileExtensionsVariable{
- "sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true
-};
-
Toolchains::Toolchains(cmFileAPI& fileAPI, unsigned long version)
: FileAPI(fileAPI)
, Version(version)
@@ -94,6 +72,25 @@ Json::Value Toolchains::DumpToolchains()
Json::Value Toolchains::DumpToolchain(std::string const& lang)
{
+ static const std::vector<ToolchainVariable> CompilerVariables{
+ { "path", "COMPILER", false },
+ { "id", "COMPILER_ID", false },
+ { "version", "COMPILER_VERSION", false },
+ { "target", "COMPILER_TARGET", false },
+ };
+
+ static const std::vector<ToolchainVariable> CompilerImplicitVariables{
+ { "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true },
+ { "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true },
+ { "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES",
+ true },
+ { "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true },
+ };
+
+ static const ToolchainVariable SourceFileExtensionsVariable{
+ "sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true
+ };
+
const auto& mf =
this->FileAPI.GetCMakeInstance()->GetGlobalGenerator()->GetMakefiles()[0];
Json::Value toolchain = Json::objectValue;