Skip to content

Commit 1326cca

Browse files
authored
Do not build shared libraries with -pie
`-pie` builds an executable and when passed after `-shared` won't create a shared library anymore. CMake 4.1.0 changed the order of `CMAKE_SHARED_LINKER_FLAGS` to be passed after the shared-library-creation-flags and the build now fails. However it was wrong to pass this flag to the shared library linking anyway, so remove it from there.
1 parent ddf0dc7 commit 1326cca

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ elseif(UNIX)
217217
message(STATUS "No ISA flag set")
218218
endif()
219219
set(COMPILE_FLAGS "-fstack-protector-strong -fpie -Wformat -Wformat-security")
220-
set(LINKER_FLAGS "-pie -Wl,-z,relro -Wl,-z,now")
220+
set(LINKER_FLAGS "-Wl,-z,relro -Wl,-z,now")
221221
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_OPTIMIZATION_FLAGS} ${COMPILE_FLAGS}")
222222
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_OPTIMIZATION_FLAGS} ${COMPILE_FLAGS}")
223-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
223+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie ${LINKER_FLAGS}")
224224
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
225225
else()
226226
message(STATUS "OS UNKNOWN CANNOT SET SIMD")

0 commit comments

Comments
 (0)