add -fPIC flag (position independent code) like in wlc

Linking fails otherwise:

Linking C executable ../bin/sway
/usr/bin/ld: CMakeFiles/sway.dir/commands.c.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
CMakeFiles/sway.dir/commands.c.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
sway/CMakeFiles/sway.dir/build.make:442: recipe for target 'bin/sway' failed
This commit is contained in:
robotanarchy 2015-12-21 19:09:39 +01:00
parent 94cac7a014
commit 03c041dd30
1 changed files with 1 additions and 0 deletions

View File

@ -9,6 +9,7 @@ add_definitions(-DFALLBACK_CONFIG_DIR=\"${FALLBACK_CONFIG_DIR}\")
set(CMAKE_C_FLAGS "-g")
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
add_definitions(
-D_GNU_SOURCE