File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,13 @@ macro(append_common_extra_security_flags)
131
131
endif ()
132
132
133
133
# Position Independent Execution
134
- if (is_gcc
135
- OR is_clang
136
- OR (is_icpx AND MSVC ))
137
- # The project should be configured with -DCMAKE_POSITION_INDEPENDENT_CODE=ON
138
- add_compile_option_ext ("-fPIE" FPIE )
139
- add_link_option_ext ("-pie" PIE CMAKE_EXE_LINKER_FLAGS
140
- CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS )
141
- elseif (is_msvc )
134
+ # We rely on CMake to set the right -fPIE flags for us, but it must be
135
+ # explicitly requested
136
+ if (NOT CMAKE_POSITION_INDEPENDENT_CODE )
137
+ message (FATAL_ERROR "To enable all necessary security flags, CMAKE_POSITION_INDEPENDENT_CODE must be set to ON" )
138
+ endif ()
139
+
140
+ if (is_msvc )
142
141
add_link_option_ext ("/DYNAMICBASE" DYNAMICBASE CMAKE_EXE_LINKER_FLAGS
143
142
CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS )
144
143
endif ()
You can’t perform that action at this time.
0 commit comments