cmake: add definitions for glibc

"-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" is not for gcc, it's for glibc
actually. so enable it on LINUX.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2016-10-25 12:20:51 +08:00
parent 7c06f7a461
commit 5f36c080bf

View File

@ -18,12 +18,15 @@ set(prefix ${CMAKE_INSTALL_PREFIX})
add_definitions("-DCEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"")
add_definitions("-DCEPH_PKGLIBDIR=\"${CMAKE_INSTALL_FULL_PKGLIBDIR}\"")
add_definitions("-DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS")
if(LINUX)
add_definitions("-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wtype-limits -Wignored-qualifiers -Winit-self")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char")
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
add_definitions("-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)