From f6389baff6258af523c588cbcfa9eb8c249d03c7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 24 Feb 2020 12:44:11 +0800 Subject: [PATCH] cmake: reduce the indent level Signed-off-by: Kefu Chai --- CMakeLists.txt | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3567e792b8..245ad0620cc 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) -- 2.39.5