blob: 6c1c770161ee44e749dc1b18590a36cc5705e5e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Guard against multiple inclusions
if(__craylinux_crayprgenv)
return()
endif()
set(__craylinux_crayprgenv 1)
macro(__CrayPrgEnv_setup lang)
if(DEFINED ENV{CRAYPE_VERSION})
message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}")
elseif(DEFINED ENV{ASYNCPE_VERSION})
message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}")
else()
message(STATUS "Cray Programming Environment (unknown version) ${lang}")
endif()
# Flags for the Cray wrappers
set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
# If the link type is not explicitly specified in the environment then
# the Cray wrappers assume that the code will be built statically so
# we check the following condition(s) are NOT met
# Compiler flags are explicitly dynamic
# Env var is dynamic and compiler flags are not explicitly static
if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR
(CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
OR
(("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR
(CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
endif()
endmacro()
|