summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakeHostSystemInformationCommand.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-07-27 22:53:22 (GMT)
committerAlex Turbov <i.zaufi@gmail.com>2021-07-27 23:18:24 (GMT)
commitd6299d9941644e1bb36d274597e53a4c9e12f3bf (patch)
tree2915ae85c87cfc6b3d138c7e50ca85b4501164a5 /Source/cmCMakeHostSystemInformationCommand.cxx
parentea28d28a6169b0431407f97403b3ac406997e153 (diff)
downloadCMake-d6299d9941644e1bb36d274597e53a4c9e12f3bf.zip
CMake-d6299d9941644e1bb36d274597e53a4c9e12f3bf.tar.gz
CMake-d6299d9941644e1bb36d274597e53a4c9e12f3bf.tar.bz2
Refactor: Run CPU/OS/Memory tests once on first run
Diffstat (limited to 'Source/cmCMakeHostSystemInformationCommand.cxx')
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 0550568..10c0714 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -45,10 +45,14 @@ bool cmCMakeHostSystemInformationCommand(std::vector<std::string> const& args,
return false;
}
- cmsys::SystemInformation info;
- info.RunCPUCheck();
- info.RunOSCheck();
- info.RunMemoryCheck();
+ static cmsys::SystemInformation info;
+ static auto initialized = false;
+ if (!initialized) {
+ info.RunCPUCheck();
+ info.RunOSCheck();
+ info.RunMemoryCheck();
+ initialized = true;
+ }
std::string result_list;
for (size_t i = current_index + 1; i < args.size(); ++i) {