-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslinker.defs.cmake
92 lines (70 loc) · 2.06 KB
/
eslinker.defs.cmake
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Common linker configurations and defines
message(
STATUS
"Setting up C++ Runtime Linking..."
)
if(MSVC)
# Set MSVC linker options.
set(compilerVars
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if(ES_USE_DYNAMIC_RUNTIME)
message(
STATUS
"MSVC -> Use MSVC dynamically-linked runtime."
)
foreach(variable ${compilerVars})
if(variable MATCHES "/MT")
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}")
endif()
endforeach()
else(ES_USE_DYNAMIC_RUNTIME)
message(
STATUS
"MSVC -> Use MSVC statically-linked runtime."
)
foreach(variable ${compilerVars})
if(variable MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
endif(ES_USE_DYNAMIC_RUNTIME)
elseif(CMAKE_COMPILER_IS_GNUCXX)
if(NOT ES_USE_DYNAMIC_RUNTIME)
message(
STATUS
"GNUCXX -> Linking against libstdc++ runtime statically"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -pthread")
else(NOT ES_USE_DYNAMIC_RUNTIME)
message(
STATUS
"GNUCXX -> Linking against libstdc++ runtime dynamically"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif(NOT ES_USE_DYNAMIC_RUNTIME)
if(MINGW)
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lmingw32")
endif(MINGW)
elseif(BORLAND AND EMBARCADERO)
if( ES_USE_DYNAMIC_RUNTIME )
# Delphi runtime, C++ runtime, Unicode
set_embt_target(DynamicRuntime DR Unicode)
else()
# Just Unicode
set_embt_target(Unicode)
endif()
endif()
# Tune-up add_library behaviour
set(BUILD_SHARED_LIBS ${ES_BUILD_SHARED_LIBS})
message(
STATUS
"eslinker.defs BUILD_SHARED_LIBS=>${BUILD_SHARED_LIBS}"
)