From d6299d9941644e1bb36d274597e53a4c9e12f3bf Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Wed, 28 Jul 2021 01:53:22 +0300 Subject: Refactor: Run CPU/OS/Memory tests once on first run --- Source/cmCMakeHostSystemInformationCommand.cxx | 12 ++++++++---- 1 file 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 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) { -- cgit v0.12