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)
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)