From: Kefu Chai Date: Mon, 24 Feb 2020 04:44:11 +0000 (+0800) Subject: cmake: reduce the indent level X-Git-Tag: v15.1.1~289^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33500%2Fhead;p=ceph.git cmake: reduce the indent level Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b3567e792b89..245ad0620cc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,16 +45,15 @@ endif() option(WITH_CCACHE "Build with ccache.") if(WITH_CCACHE) find_program(CCACHE_FOUND ccache) - if(CCACHE_FOUND) - message(STATUS "Building with ccache: ${CCACHE_FOUND}, CCACHE_DIR=$ENV{CCACHE_DIR}") - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - # ccache does not accelerate link (ld), but let it handle it. by passing it - # along with cc to python's distutils, we are able to workaround - # https://bugs.python.org/issue8027. - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) - else(CCACHE_FOUND) + if(NOT CCACHE_FOUND) message(FATAL_ERROR "Can't find ccache. Is it installed?") - endif(CCACHE_FOUND) + endif() + message(STATUS "Building with ccache: ${CCACHE_FOUND}, CCACHE_DIR=$ENV{CCACHE_DIR}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + # ccache does not accelerate link (ld), but let it handle it. by passing it + # along with cc to python's distutils, we are able to workaround + # https://bugs.python.org/issue8027. + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(WITH_CCACHE) option(WITH_MANPAGE "Build man pages." ON) @@ -101,15 +100,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_SHARED}) option(WITH_STATIC_LIBSTDCXX "Link against libstdc++ statically" OFF) if(WITH_STATIC_LIBSTDCXX) - if(CMAKE_COMPILER_IS_GNUCXX) - set(static_linker_flags "-static-libstdc++ -static-libgcc") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${static_linker_flags}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${static_linker_flags}") - unset(static_linker_flags) - set(GPERFTOOLS_USE_STATIC_LIBS TRUE) - else() + if(NOT CMAKE_COMPILER_IS_GNUCXX) message(FATAL_ERROR "Please use GCC to enable WITH_STATIC_LIBSTDCXX") endif() + set(static_linker_flags "-static-libstdc++ -static-libgcc") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${static_linker_flags}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${static_linker_flags}") + unset(static_linker_flags) + set(GPERFTOOLS_USE_STATIC_LIBS TRUE) endif() include(CheckCxxAtomic) if(NOT HAVE_CXX11_ATOMIC)