MantisBT - CMake
View Issue Details
0014208CMakeCMakepublic2013-06-07 09:352013-10-28 13:40
Nils Gladitz 
Brad King 
normalfeaturealways
closedfixed 
CMake 2.8.11 
CMake 2.8.12CMake 2.8.12 
0014208: Provide build system information query command
kwsys provides system information query functions in SystemInformation.cxx.

CTest queries and transmits system information to CDash but there doesn't seem to be any way for me to access that information from CMake itself.

A query command like e.g. get_system_information(TOTAL_VIRTUAL_MEMORY <output_variable>) would be nice.

Personally I'd like to see how much memory the system has available so I can estimate an upper limit of tests that I can run in parallel.

It could also render the rather complicated implementation of ProcessorCount.cmake obsolete.
No tags attached.
patch 0001-implemented-new-cmake_host_system_information-comman.patch (11,160) 2013-06-07 16:52
https://public.kitware.com/Bug/file/4783/0001-implemented-new-cmake_host_system_information-comman.patch
patch 0001-implemented-cmake_host_system_information-with-exten.patch (12,532) 2013-06-14 17:12
https://public.kitware.com/Bug/file/4791/0001-implemented-cmake_host_system_information-with-exten.patch
patch 0001-implemented-cmake_host_system_information-with-exten2.patch (12,600) 2013-06-15 01:40
https://public.kitware.com/Bug/file/4793/0001-implemented-cmake_host_system_information-with-exten2.patch
Issue History
2013-06-07 09:35Nils GladitzNew Issue
2013-06-07 09:40Brad KingNote Added: 0033250
2013-06-07 09:40Brad KingStatusnew => backlog
2013-06-07 16:52Nils GladitzFile Added: 0001-implemented-new-cmake_host_system_information-comman.patch
2013-06-07 16:55Nils GladitzNote Added: 0033257
2013-06-13 09:06Brad KingNote Added: 0033279
2013-06-13 10:55Nils GladitzNote Added: 0033280
2013-06-13 10:58Brad KingNote Added: 0033281
2013-06-14 17:12Nils GladitzFile Added: 0001-implemented-cmake_host_system_information-with-exten.patch
2013-06-14 17:13Nils GladitzNote Added: 0033313
2013-06-15 01:40Nils GladitzFile Added: 0001-implemented-cmake_host_system_information-with-exten2.patch
2013-06-15 01:41Nils GladitzNote Added: 0033316
2013-06-19 08:50Brad KingNote Added: 0033323
2013-06-19 08:50Brad KingAssigned To => Brad King
2013-06-19 08:50Brad KingStatusbacklog => resolved
2013-06-19 08:50Brad KingResolutionopen => fixed
2013-06-19 08:50Brad KingFixed in Version => CMake 2.8.12
2013-06-19 08:50Brad KingTarget Version => CMake 2.8.12
2013-10-28 13:40Nils GladitzStatusresolved => closed

Notes
(0033250)
Brad King   
2013-06-07 09:40   
This is a good proposal. Perhaps the command should be called

 cmake_host_system_information

because it can only collect information from the host running CMake and can never say anything about a target platform (e.g. during cross compiling).
(0033257)
Nils Gladitz   
2013-06-07 16:55   
I've given the implementation a try and attached a patch.

I only implemented a small subset of the information provided by cmsys::SystemInformation for which I could think of use cases or which didn't already seem to be covered but I guess it could be extended as demand arises.
(0033279)
Brad King   
2013-06-13 09:06   
Thanks for working on a patch.

+ " cmake_host_system_information(<key> <variable>)\n"

I'd like to design an API that is more extensible in the future. Perhaps

 cmake_host_system_information(RESULT <var> QUERY <key>...)

where <key>... can be zero or more keys whose results will be stored as a list in <var>. Other ideas?
(0033280)
Nils Gladitz   
2013-06-13 10:55   
I can't think of a use case for lists and can't think of potential extensions for this but I am not strongly opposed.

What might be convenient for some uses would be a format string or variable substitution scheme similar to configure_file e.g. cmake_host_system_information(RESULT MY_VAR FORMAT "<HOSTNAME> has <NUMBER_OF_PHYSICAL_CORES> physical cores")

Though I could just as well manually concatenate those and would probably prefer to keep the command single purpose.
(0033281)
Brad King   
2013-06-13 10:58   
The format mode would be a good candidate for future expansion but need not be implemented now. However, it serves as an example for why we want an extensible interface.
(0033313)
Nils Gladitz   
2013-06-14 17:13   
I've uploaded a new patch that should implement the suggested interface.
(0033316)
Nils Gladitz   
2013-06-15 01:41   
Updated documentation to match the new interface.
(0033323)
Brad King   
2013-06-19 08:50   
Patch applied, thanks!

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb71a3a0 [^]