@@ -83,7 +83,7 @@ set(CFI_FLAGS "")
8383if (CXX_HAS_CFI_SANITIZE)
8484 # cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't
8585 # guarantee. -fsanitize=cfi depends on -flto
86- set (CFI_FLAGS "-flto -fsanitize=cfi -fno-sanitize=cfi-icall -fsanitize-ignorelist=${PROJECT_SOURCE_DIR} /sanitizer-ignorelist.txt" )
86+ set (CFI_FLAGS "-flto; -fsanitize=cfi; -fno-sanitize=cfi-icall; -fsanitize-ignorelist=${PROJECT_SOURCE_DIR} /sanitizer-ignorelist.txt" )
8787endif ()
8888
8989function (add_ur_target_compile_options name )
@@ -103,17 +103,15 @@ function(add_ur_target_compile_options name)
103103 -fstack-protector-strong
104104 -fvisibility=hidden
105105
106+ ${CFI_FLAGS}
107+
106108 $<$<BOOL :${CXX_HAS_FCF_PROTECTION_FULL} >:-fcf-protection=full>
107109 $<$<BOOL :${CXX_HAS_FSTACK_CLASH_PROTECTION} >:-fstack-clash-protection>
108110
109111 # Colored output
110112 $<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
111113 $<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
112114 )
113- # Cmake can't handle mixing strings without quotes as the options above
114- # are and strings with quotes like ${CFI_FLAGS} is, so this needs a
115- # separate call.
116- target_compile_options (${name} PRIVATE ${CFI_FLAGS} )
117115 if (UR_DEVELOPER_MODE)
118116 target_compile_options (${name} PRIVATE -Werror -Wextra)
119117 endif ()
@@ -154,7 +152,8 @@ function(add_ur_target_link_options name)
154152 if (NOT MSVC )
155153 if (NOT APPLE )
156154 target_link_options (${name} PRIVATE
157- "LINKER:-z,relro,-z,now,-z,noexecstack ${CFI_FLAGS} "
155+ ${CFI_FLAGS}
156+ "LINKER:-z,relro,-z,now,-z,noexecstack"
158157 )
159158 if (UR_DEVELOPER_MODE)
160159 target_link_options (${name} PRIVATE -Werror -Wextra)
0 commit comments