1# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end 2# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake 3 4set(UNIX 1) 5 6if(DEFINED ENV{CRAYOS_VERSION}) 7 set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") 8elseif(DEFINED ENV{XTOS_VERSION}) 9 set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") 10elseif(EXISTS /etc/opt/cray/release/cle-release) 11 file(STRINGS /etc/opt/cray/release/cle-release release REGEX "^RELEASE=.*") 12 string(REGEX REPLACE "^RELEASE=(.*)$" "\\1" CMAKE_SYSTEM_VERSION "${release}") 13 unset(release) 14elseif(EXISTS /etc/opt/cray/release/clerelease) 15 file(READ /etc/opt/cray/release/clerelease CMAKE_SYSTEM_VERSION) 16endif() 17 18# Guard against multiple messages 19if(NOT __CrayLinuxEnvironment_message) 20 set(__CrayLinuxEnvironment_message 1 CACHE INTERNAL "") 21 if(NOT CMAKE_SYSTEM_VERSION) 22 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).") 23 else() 24 message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") 25 endif() 26endif() 27 28# All cray systems are x86 CPUs and have been for quite some time 29# Note: this may need to change in the future with 64-bit ARM 30set(CMAKE_SYSTEM_PROCESSOR "x86_64") 31 32# Don't override shared lib support if it's already been set and possibly 33# overridden elsewhere by the CrayPrgEnv module 34if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) 35 set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") 36 set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) 37endif() 38 39# The rest of this file is based on UnixPaths.cmake, adjusted for Cray 40 41# add the install directory of the running cmake to the search directories 42# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up 43get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) 44get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) 45 46# Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy 47# of the NIDs userland. If so, then we'll use it. Otherwise, just assume 48# the userland from the login node is ok 49 50# List common installation prefixes. These will be used for all 51# search types. 52list(APPEND CMAKE_SYSTEM_PREFIX_PATH 53 # Standard 54 $ENV{SYSROOT_DIR}/usr/local $ENV{SYSROOT_DIR}/usr $ENV{SYSROOT_DIR}/ 55 56 # CMake install location 57 "${__cmake_install_dir}" 58 ) 59if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) 60 list(APPEND CMAKE_SYSTEM_PREFIX_PATH 61 # Project install destination. 62 "${CMAKE_INSTALL_PREFIX}" 63 ) 64 if(CMAKE_STAGING_PREFIX) 65 list(APPEND CMAKE_SYSTEM_PREFIX_PATH 66 # User-supplied staging prefix. 67 "${CMAKE_STAGING_PREFIX}" 68 ) 69 endif() 70endif() 71 72list(APPEND CMAKE_SYSTEM_INCLUDE_PATH 73 $ENV{SYSROOT_DIR}/usr/include/X11 74) 75list(APPEND CMAKE_SYSTEM_LIBRARY_PATH 76 $ENV{SYSROOT_DIR}/usr/local/lib64 77 $ENV{SYSROOT_DIR}/usr/lib64 78 $ENV{SYSROOT_DIR}/lib64 79) 80list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 81 $ENV{SYSROOT_DIR}/usr/local/lib64 82 $ENV{SYSROOT_DIR}/usr/lib64 83 $ENV{SYSROOT_DIR}/lib64 84) 85 86# Enable use of lib64 search path variants by default. 87set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) 88