File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ function(add_ur_target_compile_options name)
66
66
$< $< CXX_COMPILER_ID:GNU> :-fdiagnostics-color=always>
67
67
$< $< CXX_COMPILER_ID:Clang,AppleClang> :-fcolor-diagnostics>
68
68
)
69
-
70
69
if (CMAKE_BUILD_TYPE STREQUAL "Release" )
71
70
target_compile_definitions (${name} PRIVATE -D_FORTIFY_SOURCE=2 )
72
71
endif ()
@@ -84,27 +83,46 @@ function(add_ur_target_compile_options name)
84
83
/MD$<$<CONFIG:Debug>:d>
85
84
/GS
86
85
)
87
- add_link_options (
86
+
87
+ if (UR_DEVELOPER_MODE )
88
+ target_compile_options (${name} PRIVATE /WX /GS )
89
+ endif ()
90
+ endif ()
91
+ endfunction ()
92
+
93
+ function (add_ur_target_link_options name )
94
+ if (NOT MSVC )
95
+ if (NOT APPLE )
96
+ target_link_options (${name} PRIVATE "LINKER:-z,relro,-z,now" )
97
+ endif ()
98
+ elseif (MSVC )
99
+ target_link_options (${name} PRIVATE
88
100
/DYNAMICBASE
89
101
/HIGHENTROPYVA
90
- /ALLOWISOLATION
91
102
/NXCOMPAT
92
103
)
104
+ endif ()
105
+ endfunction ()
93
106
94
- if (UR_DEVELOPER_MODE )
95
- target_compile_options (${name} PRIVATE /WX /GS )
96
- endif ()
107
+ function (add_ur_target_exec_options name )
108
+ if (MSVC )
109
+ target_link_options (${name} PRIVATE
110
+ /ALLOWISOLATION
111
+ )
97
112
endif ()
98
113
endfunction ()
99
114
100
115
function (add_ur_executable name )
101
116
add_executable (${name} ${ARGN} )
102
117
add_ur_target_compile_options (${name} )
118
+ add_ur_target_exec_options (${name} )
119
+ add_ur_target_link_options (${name} )
103
120
endfunction ()
104
121
105
122
function (add_ur_library name )
106
123
add_library (${name} ${ARGN} )
107
124
add_ur_target_compile_options (${name} )
125
+ add_ur_target_link_options (${name} )
108
126
endfunction ()
109
127
110
128
include (FetchContent )
You can’t perform that action at this time.
0 commit comments