From: Kefu Chai Date: Tue, 25 Oct 2016 04:20:51 +0000 (+0800) Subject: cmake: add definitions for glibc X-Git-Tag: v11.1.0~500^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f36c080bf137c221e65369ca09fdea59e0ddfd4;p=ceph.git 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 --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 739d1485178c..00aef846709f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)