diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2013-06-15 05:38:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-06-19 12:46:37 (GMT) |
commit | bb71a3a0dfaba317c7a98b92301310e15f602c38 (patch) | |
tree | 0ae6f7bd8a4dfe223333aeda53ecdb49e5e3dc10 /Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in | |
parent | dea8271840b69bef078d7af324a72636ff195c94 (diff) | |
download | CMake-bb71a3a0dfaba317c7a98b92301310e15f602c38.zip CMake-bb71a3a0dfaba317c7a98b92301310e15f602c38.tar.gz CMake-bb71a3a0dfaba317c7a98b92301310e15f602c38.tar.bz2 |
Add cmake_host_system_information command
Expose the internal system information API to the CMake language. For
example, it is useful to see how much memory the system has available to
estimate an upper limit of tests that can run in parallel.
Diffstat (limited to 'Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in')
-rw-r--r-- | Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in new file mode 100644 index 0000000..3294a2f --- /dev/null +++ b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in @@ -0,0 +1,33 @@ +set(BadArg1-RESULT 1) +set(BadArg1-STDERR "missing RESULT specification") +set(BadArg2-RESULT 1) +set(BadArg2-STDERR "missing QUERY specification") +set(BadArg3-RESULT 1) +set(BadArg3-STDERR "does not recognize <key> FOOBAR") +set(QueryList-RESULT 0) +set(QueryList-STDERR "\\[[0-9]+;[0-9]+\\]") + +function(try_and_print key) + cmake_host_system_information(RESULT RESULT QUERY ${key}) + message(STATUS "[${key}] [${RESULT}]") +endfunction() + +message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") + +try_and_print(NUMBER_OF_LOGICAL_CORES) +try_and_print(NUMBER_OF_PHYSICAL_CORES) +try_and_print(HOSTNAME) +try_and_print(FQDN) +try_and_print(TOTAL_VIRTUAL_MEMORY) +try_and_print(AVAILABLE_VIRTUAL_MEMORY) +try_and_print(TOTAL_PHYSICAL_MEMORY) +try_and_print(AVAILABLE_PHYSICAL_MEMORY) + +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") + +check_cmake_test(CMakeHostSystemInformation + BadArg1 + BadArg2 + BadArg3 + QueryList +) |