Cray compiler CMake toolchain
Cray PE can select from multiple compilers as backends for better language standard support while maintaining performance of Cray frontend optimizations. Compilers such as Intel oneAPI themselves use GCC as a backend on Linux. Manual configuration may be required as the default system GCC may be too old for the desired language standard features. Or, the libstdc++ can be too old in the system default GCC. These issues are remediated by purposeful specification of the Cray-Intel-GCC toolchain in a CMake toolchain file.
This toolchain file can be copied to a common location like ~ and used among many projects, such as cray.cmake.
For CMake project that have ExternalProject inside them, there must be a CMAKE_TOOLCHAIN_FILE parameter to ExternalProject_Add like:
set(cmake_args ...)
if(CMAKE_TOOLCHAIN_FILE)
list(APPEND cmake_args -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE})
endif()
ExternalProject_Add(...
CMAKE_ARGS ${cmake_args}
)
The CMake project is configured like:
cmake --toolchain ~/cray.cmake -B build