@@ -10,120 +10,14 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
10
10
string (APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS} " )
11
11
string (APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS} " )
12
12
13
- foreach (t EXE SHARED MODULE STATIC )
14
- foreach (c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
15
- string (STRIP "${CMAKE_${t} _LINKER_FLAGS${c} _INIT}" CMAKE_${t} _LINKER_FLAGS${c} _INIT)
16
- endforeach ()
17
- endforeach ()
18
-
19
- if (NOT CMAKE_NOT_USING_CONFIG_FLAGS )
20
- get_property (_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
21
- # default build type is none
22
- if (NOT _GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_NO_BUILD_TYPE)
23
- set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
24
- "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." )
25
- endif ()
26
- unset (_GENERATOR_IS_MULTI_CONFIG)
27
-
28
- set (CMAKE_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
29
- "Flags used by the linker during debug builds." )
30
-
31
- set (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT} CACHE STRING
32
- "Flags used by the linker during release minsize builds." )
33
-
34
- set (CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
35
- "Flags used by the linker during release builds." )
36
-
37
- set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
38
- ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
39
- "Flags used by the linker during Release with Debug Info builds." )
40
-
41
- set (CMAKE_SHARED_LINKER_FLAGS_DEBUG ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
42
- "Flags used by the linker during debug builds." )
43
-
44
- set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL ${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT}
45
- CACHE STRING
46
- "Flags used by the linker during release minsize builds." )
47
-
48
- set (CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
49
- "Flags used by the linker during release builds." )
50
-
51
- set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
52
- ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
53
- "Flags used by the linker during Release with Debug Info builds." )
54
-
55
- set (CMAKE_MODULE_LINKER_FLAGS_DEBUG ${CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
56
- "Flags used by the linker during debug builds." )
57
-
58
- set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL ${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT}
59
- CACHE STRING
60
- "Flags used by the linker during release minsize builds." )
61
-
62
- set (CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
63
- "Flags used by the linker during release builds." )
64
-
65
- set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
66
- ${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
67
- "Flags used by the linker during Release with Debug Info builds." )
68
-
69
- set (CMAKE_STATIC_LINKER_FLAGS_DEBUG ${CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
70
- "Flags used by the linker during debug builds." )
71
-
72
- set (CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL_INIT}
73
- CACHE STRING
74
- "Flags used by the linker during release minsize builds." )
75
-
76
- set (CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
77
- "Flags used by the linker during release builds." )
78
-
79
- set (CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
80
- ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
81
- "Flags used by the linker during Release with Debug Info builds." )
82
- endif ()
83
-
84
- # executable linker flags
85
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} "
86
- CACHE STRING "Flags used by the linker." )
87
-
88
- # shared linker flags
89
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} "
90
- CACHE STRING "Flags used by the linker during the creation of dll's." )
91
-
92
- # module linker flags
93
- set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} "
94
- CACHE STRING "Flags used by the linker during the creation of modules." )
95
-
96
- # static linker flags
97
- set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT} "
98
- CACHE STRING "Flags used by the linker during the creation of static libraries." )
13
+ cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker" )
14
+ cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries" )
15
+ cmake_initialize_per_config_variable(CMAKE_MODULE_LINKER_FLAGS "Flags used by the linker during the creation of modules" )
16
+ cmake_initialize_per_config_variable(CMAKE_STATIC_LINKER_FLAGS "Flags used by the linker during the creation of static libraries" )
99
17
100
18
# Alias the build tool variable for backward compatibility.
101
19
set (CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} )
102
20
103
21
mark_as_advanced (
104
22
CMAKE_VERBOSE_MAKEFILE
105
-
106
- CMAKE_EXE_LINKER_FLAGS
107
- CMAKE_EXE_LINKER_FLAGS_DEBUG
108
- CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
109
- CMAKE_EXE_LINKER_FLAGS_RELEASE
110
- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
111
-
112
- CMAKE_SHARED_LINKER_FLAGS
113
- CMAKE_SHARED_LINKER_FLAGS_DEBUG
114
- CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
115
- CMAKE_SHARED_LINKER_FLAGS_RELEASE
116
- CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
117
-
118
- CMAKE_MODULE_LINKER_FLAGS
119
- CMAKE_MODULE_LINKER_FLAGS_DEBUG
120
- CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
121
- CMAKE_MODULE_LINKER_FLAGS_RELEASE
122
- CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
123
-
124
- CMAKE_STATIC_LINKER_FLAGS
125
- CMAKE_STATIC_LINKER_FLAGS_DEBUG
126
- CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
127
- CMAKE_STATIC_LINKER_FLAGS_RELEASE
128
- CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
129
23
)
0 commit comments