CrayLinuxEnvironment: Add alternative methods to get version info

Closes: #16229
This commit is contained in:
Chuck Atkins 2016-08-04 14:46:10 -04:00
parent f59513140b
commit e52302d6cb
2 changed files with 14 additions and 4 deletions

View File

@ -56,6 +56,8 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd)
message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}")
elseif(DEFINED ENV{ASYNCPE_VERSION}) elseif(DEFINED ENV{ASYNCPE_VERSION})
message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}") message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}")
else()
message(STATUS "Cray Programming Environment (unknown version) ${lang}")
endif() endif()
# Flags for the Cray wrappers # Flags for the Cray wrappers

View File

@ -8,14 +8,22 @@ if(DEFINED ENV{CRAYOS_VERSION})
set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}")
elseif(DEFINED ENV{XTOS_VERSION}) elseif(DEFINED ENV{XTOS_VERSION})
set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}")
else() elseif(EXISTS /etc/opt/cray/release/cle-release)
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)") 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() endif()
# Guard against multiple messages # Guard against multiple messages
if(NOT __CrayLinuxEnvironment_message) if(NOT __CrayLinuxEnvironment_message)
set(__CrayLinuxEnvironment_message 1) set(__CrayLinuxEnvironment_message 1 CACHE INTERNAL "")
message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") 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() endif()
# All cray systems are x86 CPUs and have been for quite some time # All cray systems are x86 CPUs and have been for quite some time