summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/CrayLinuxEnvironment.cmake
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2016-08-04 18:46:10 (GMT)
committerChuck Atkins <chuck.atkins@kitware.com>2016-08-05 13:01:43 (GMT)
commite52302d6cbee72c9d680affcf1f253bfa61f1891 (patch)
tree667045423eda055fd85be7d92da41b4e3e004674 /Modules/Platform/CrayLinuxEnvironment.cmake
parentf59513140bf086eda2029c5b4e950fc58216c06e (diff)
downloadCMake-e52302d6cbee72c9d680affcf1f253bfa61f1891.zip
CMake-e52302d6cbee72c9d680affcf1f253bfa61f1891.tar.gz
CMake-e52302d6cbee72c9d680affcf1f253bfa61f1891.tar.bz2
CrayLinuxEnvironment: Add alternative methods to get version info
Closes: #16229
Diffstat (limited to 'Modules/Platform/CrayLinuxEnvironment.cmake')
-rw-r--r--Modules/Platform/CrayLinuxEnvironment.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake
index 97771a2..a1a3d3f 100644
--- a/Modules/Platform/CrayLinuxEnvironment.cmake
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -8,14 +8,22 @@ if(DEFINED ENV{CRAYOS_VERSION})
set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}")
elseif(DEFINED ENV{XTOS_VERSION})
set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}")
-else()
- message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)")
+elseif(EXISTS /etc/opt/cray/release/cle-release)
+ file(STRINGS /etc/opt/cray/release/cle-release release REGEX "^RELEASE=.*")
+ string(REGEX REPLACE "^RELEASE=(.*)$" "\\1" CMAKE_SYSTEM_VERSION "${release}")
+ unset(release)
+elseif(EXISTS /etc/opt/cray/release/clerelease)
+ file(READ /etc/opt/cray/release/clerelease CMAKE_SYSTEM_VERSION)
endif()
# Guard against multiple messages
if(NOT __CrayLinuxEnvironment_message)
- set(__CrayLinuxEnvironment_message 1)
- message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}")
+ set(__CrayLinuxEnvironment_message 1 CACHE INTERNAL "")
+ if(NOT CMAKE_SYSTEM_VERSION)
+ message(STATUS "CrayLinuxEnvironment: Unable to determine CLE version. This platform file should only be used from inside the Cray Linux Environment for targeting compute nodes (NIDs).")
+ else()
+ message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}")
+ endif()
endif()
# All cray systems are x86 CPUs and have been for quite some time