diff options
author | Sven Gothel <[email protected]> | 2021-01-11 11:14:15 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-11 11:14:15 +0100 |
commit | 5a430f4b4c6d92f2ea40cfa96583be3b388a8e70 (patch) | |
tree | ef9dc39f6a340a56adcce6738f714fecd621c894 /CMakeLists.txt | |
parent | c4703f075c13683927916e779b900c3408c44073 (diff) |
if DEBUG and GNUCC: Add '-no-pie' to allow addr2source find the line of code in a backtrace etc
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7f8bca..bb05c0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ endif(CMAKE_COMPILER_IS_GNUCC) if(DEBUG) if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -ggdb -DDEBUG -fno-omit-frame-pointer ${GCC_FLAGS_STACK}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -ggdb -DDEBUG -fno-omit-frame-pointer ${GCC_FLAGS_STACK} -no-pie") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG") endif(CMAKE_COMPILER_IS_GNUCC) @@ -62,8 +62,13 @@ endif(DEBUG) # '-latomic' is required using gcc-8 on Raspberry ... to avoid: undefined reference to `__atomic_store_8' if(DEBUG) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -latomic") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic") + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -latomic -no-pie") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic -no-pie") + else() + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -latomic") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic") + endif(CMAKE_COMPILER_IS_GNUCC) else() set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-rtti -latomic") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-rtti -latomic") |