Commit 8e7ecaa7 authored by Robert Schmidt's avatar Robert Schmidt

Compile using -rdynamic with clang

-rdynamic is necessary for clang as well to properly link shared
executables. Add furthermore an option to ignore unused command line
arguments, to suppress warning

  clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]

This is likely because -rdynamic is only relevant for the linker, but
the corresponding option add_link_options() is only available starting
cmake 3.13, while we are still at 3.12 (for Ubuntu 18, to my
understanding).
parent 74977924
......@@ -158,11 +158,16 @@ endif()
# add autotools definitions that were maybe used!
add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP")
set(commonOpts "-pipe -fPIC -Wall -fno-strict-aliasing")
# we need -rdynamic to incorporate all symbols in shared objects, see man page
set(commonOpts "-pipe -fPIC -Wall -fno-strict-aliasing -rdynamic")
# GNU C/C++ Compiler might throw many warnings without packed-bitfield-compat, see man page
# also, we need -rdynamic to incorporate all symbols in shared objects, again, see man page
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(commonOpts "${commonOpts} -Wno-packed-bitfield-compat -rdynamic")
set(commonOpts "${commonOpts} -Wno-packed-bitfield-compat")
endif()
# clang: suppress complaints about unused command line argument (-rdynamic only
# used during linking)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(commonOpts "${commonOpts} -Wno-unused-command-line-argument")
endif()
set(CMAKE_C_FLAGS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment