diff --git a/CMakeLists.txt b/CMakeLists.txt index f59fc12ac..9965d809e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,13 +69,16 @@ target_link_libraries(OS_INTERFACE INTERFACE Threads::Threads) if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(DL_LIBRARY "dl") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # This is only relevant for GCC and causes warnings on Clang - set(EXPORTSYMBOLS "-Wl,-export-dynamic -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap.gcc") - set(OS_CXX_FLAGS "${OS_CXX_FLAGS} -Wno-tsan -Wl,-z,now") - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + add_link_options( + -Wno-tsan -Wl,-z,relro,-z,now -Wl,-export-dynamic -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap.gcc + ) endif() + message("Matt: Adding wrap options") + add_link_options(-Wl,--wrap=socket,--wrap=accept,--wrap=open) set(NO_DEPRECATED "") set(OPTIMIZE "") @@ -97,14 +100,12 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") -Wformat -Wformat-security -Wpedantic - -Werror + # -Werror ) # force all use of std::mutex and std::recursive_mutex to use runtime init # instead of static initialization so mutexes can be hooked to enable PI as needed add_definitions(-D_GTHREAD_USE_MUTEX_INIT_FUNC -D_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC -D_FORTIFY_SOURCE=${_FORTIFY_SOURCE}) - - add_link_options(-Wl,--wrap=socket,--wrap=accept,--wrap=open) endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")