diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d76434190..6fc6fc7e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,12 +189,17 @@ elseif(${CPUARCH} NOT STREQUAL "x86_64") message(FATAL_ERROR "Cannot compile for CPU architecture ${CPUARCH}") endif() -set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -fno-var-tracking-assignments -march=native") +set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -march=native") # 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 -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic") +set(commonOpts "-pipe -fPIC -Wall -fno-strict-aliasing") +# 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") +endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu11 -funroll-loops")