X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=CMakeConfig.txt;h=3c44a776af5aabbf0fd0ff53ec6599a9a10a3e92;hb=f9c4c047caf6847f06e8059e11aff90e1ccdd84b;hp=5f1b47abd37942e20b09465e51af7ee001b791b7;hpb=f4fcfcef18090e6d636aabfcd48adadcfb2db554;p=m6w6%2Flibmemcached diff --git a/CMakeConfig.txt b/CMakeConfig.txt index 5f1b47ab..3c44a776 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -1,54 +1,85 @@ -set(CMAKE_BUILD_TYPE Release - CACHE STRING "build type (Release, Debug, ...)") + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + if(NOT DEFINED ENV{CMAKE_BUILD_TYPE}) + set(ENV{CMAKE_BUILD_TYPE} Release) + endif() + set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE} + CACHE STRING "build type (Release, Debug, ...)" FORCE) +endif() set(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "install prefix") -# make test - -set(BUILD_TESTING ON - CACHE STRING "whether to enable build of the test suite") - -set(ENABLE_SANITIZERS "" - CACHE STRING "sanitizers to enable (e.g. address undefined ...)") - -set(MEMCACHED_BINARY "/usr/bin/memcached" - CACHE FILEPATH "memcached binary") - -# sasl - -set(ENABLE_SASL OFF - CACHE BOOL "enable SASL support") - -# hashes - -set(ENABLE_FNV64_HASH ON - CACHE BOOL "enable fnv64 hash support") -set(ENABLE_MURMUR_HASH ON - CACHE BOOL "enable murmur hash support") -set(ENABLE_HSIEH_HASH OFF - CACHE BOOL "enable hsieh hash support") - -# memaslap, needs libevent and stdatomic -set(ENABLE_MEMASLAP ON - CACHE BOOL "enable memaslap client") - -# dtrace - -set(ENABLE_DTRACE OFF - CACHE BOOL "enable dtrace support") - -# sphinx - -set(SPHINX_OPTIONS "" - CACHE STRING "additional sphinx-build command line options") -set(SPHINX_THEME "sphinx_rtd_theme" - CACHE STRING "sphinx HTML theme") -set(SPHINX_THEME_OPTIONS "'collapse_navigation':False, 'navigation_depth':2, 'titles_only':False, 'includehidden':False" - CACHE STRING "sphinx HTML theme options") -set(SPHINX_EXTENSIONS "" - CACHE STRING "comma separated list of quoted sphinx extensions") -set(SPHINX_CONF_APPEND "" - CACHE STRING "append verbatim code to sphinx' conf.py") +if(APPLE) + set(CMAKE_INSTALL_RPATH @loader_path + CACHE STRING "set relative rpath") +elseif(UNIX) + # FIXME + set(CMAKE_INSTALL_RPATH "\$ORIGIN" + CACHE STRING "set relative rpath") +endif() + +option(BUILD_TESTING "whether to enable build of the test suite" + $ENV{BUILD_TESTING}) +option(BUILD_DOCSONLY "build *only* documentation" + $ENV{BUILD_DOCSONLY}) +option(BUILD_DOCS "build documentation" + ${BUILD_DOCSONLY}) +option(BUILD_DOCS_HTML "build HTML docs" + ${BUILD_DOCS}) +option(BUILD_DOCS_MAN "build manpages" + ${BUILD_DOCS}) +option(BUILD_DOCS_MANGZ "gzip manpages" + ${BUILD_DOCS_MAN}) + +set(ENABLE_SANITIZERS "$ENV{ENABLE_SANITIZERS}" + CACHE STRING "sanitizers to enable (e.g. address undefined ...)") +option(ENABLE_SASL "enable SASL support" + $ENV{ENABLE_SASL}) +option(ENABLE_DTRACE "enable dtrace support" + $ENV{ENABLE_DTRACE}) +option(ENABLE_HASH_HSIEH "enable hsieh hash support" + $ENV{ENABLE_HASH_HSIEH}) +if(NOT DEFINED ENV{ENABLE_HASH_FNV64}) + set(ENV{ENABLE_HASH_FNV64} ON) +endif() +option(ENABLE_HASH_FNV64 "enable fnv64 hash support" + $ENV{ENABLE_HASH_FNV64}) +if(NOT DEFINED ENV{ENABLE_HASH_MURMUR}) + set(ENV{ENABLE_HASH_MURMUR} ON) +endif() +option(ENABLE_HASH_MURMUR "enable murmur hash support" + $ENV{ENABLE_HASH_MURMUR}) +if(NOT DEFINED ENV{ENABLE_MEMASLAP}) + set(ENV{ENABLE_MEMASLAP} ON) +endif() +option(ENABLE_MEMASLAP "enable memaslap client" + $ENV{ENABLE_MEMASLAP}) + +if(BUILD_TESTING) + set(MEMCACHED_BINARY "$ENV{MEMCACHED_BINARY}" + CACHE STRING "memcached binary") + set(CMAKE_CTEST_ARGUMENTS "--output-on-failure") + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17) + # available since CMake 3.17 + list(APPEND CMAKE_CTEST_ARGUMENTS --repeat until-pass:2) + if(NOT "$ENV{CIRRUS_CI}") + list(APPEND CMAKE_CTEST_ARGUMENTS -j2) + endif() + endif() +endif() + +if(BUILD_DOCS) + set(SPHINX_OPTIONS "" + CACHE STRING "additional sphinx-build command line options") + set(SPHINX_THEME "sphinx_rtd_theme" + CACHE STRING "sphinx HTML theme") + set(SPHINX_THEME_OPTIONS "" + CACHE STRING "sphinx HTML theme options") + set(SPHINX_EXTENSIONS "" + CACHE STRING "comma separated list of quoted sphinx extensions") + set(SPHINX_CONF_APPEND "" + CACHE STRING "append verbatim code to sphinx' conf.py") +endif() # legacy @@ -58,5 +89,8 @@ set(HAVE_GCC_BUILTIN_ATOMIC 1) # modules +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") -include(CMake/_Include.cmake) +if(NOT BUILD_DOCSONLY) + include(CMake/_Include.cmake) +endif()