Skip to content

Commit 178f627

Browse files
committed
Don't set -pie on shared objects
Addresses intel/llvm#16677 by only setting `-pie` linker object in Release builds on executables rather than on any type of target.
1 parent 08d36b7 commit 178f627

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Diff for: cmake/helpers.cmake

+9-6
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ function(add_ur_target_link_options name)
157157
if (UR_DEVELOPER_MODE)
158158
target_link_options(${name} PRIVATE -Werror -Wextra)
159159
endif()
160-
if (CMAKE_BUILD_TYPE STREQUAL "Release")
161-
target_link_options(${name} PRIVATE
162-
$<$<CXX_COMPILER_ID:GNU>:-pie>
163-
)
164-
endif()
165160
endif()
166161
elseif(MSVC)
167162
target_link_options(${name} PRIVATE
@@ -176,7 +171,15 @@ function(add_ur_target_link_options name)
176171
endfunction()
177172

178173
function(add_ur_target_exec_options name)
179-
if(MSVC)
174+
if(NOT MSVC)
175+
if(NOT APPLE)
176+
if(CMAKE_BUILD_TYPE STREQUAL "Release")
177+
target_link_options(${name} PRIVATE
178+
$<$<CXX_COMPILER_ID:GNU>:-pie>
179+
)
180+
endif()
181+
endif()
182+
elseif(MSVC)
180183
target_link_options(${name} PRIVATE
181184
LINKER:/ALLOWISOLATION
182185
)

0 commit comments

Comments
 (0)