1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

cmake: enable position independent code (PIE)

Fixes the following build error when compiling Fedora 45 RPM:

/usr/bin/ld.bfd: tests/unit/CMakeFiles/tests.dir/tests.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld.bfd: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

See: https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
     https://cmake.org/cmake/help/latest/policy/CMP0083.html
This commit is contained in:
LuK1337
2026-03-29 17:48:04 +02:00
committed by Sébastien Helleu
parent a4a06f255a
commit 8c0a3b4d81
+1
View File
@@ -28,6 +28,7 @@ project(weechat C)
# CMake options
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_SKIP_RPATH ON)
# compiler options