Commit 7c5c6fa6 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-25090: Depend on libpmem where available

WITH_PMEM: Change the parameter from BOOL to a ternary STRING
with a default value that allows to use libpmem when it is available.
In this way, a libpmem dependency will be automatically installed
on other than Debian-based systems, based on what is available on
the continuous integraton system for building the packages.

WITH_PMEM=auto (default): Use libpmem when available.
WITH_PMEM=yes: Require libpmem to be available.
WITH_PMEM=no: Do not depend on libpmem.
parent 418381bf
INCLUDE(CheckIncludeFiles) INCLUDE(CheckIncludeFiles)
OPTION(WITH_PMEM "Enable persistent memory features" OFF) SET(WITH_PMEM "auto" CACHE STRING "Enable persistent memory features")
IF(WITH_PMEM) IF(WITH_PMEM STREQUAL "yes" OR WITH_PMEM STREQUAL "auto")
FIND_LIBRARY(LIBPMEM pmem) FIND_LIBRARY(LIBPMEM pmem)
CHECK_INCLUDE_FILES(libpmem.h HAVE_LIBPMEM_H) CHECK_INCLUDE_FILES(libpmem.h HAVE_LIBPMEM_H)
IF (NOT LIBPMEM) IF (NOT LIBPMEM)
MESSAGE(FATAL_ERROR "Can't find libpmem") IF(WITH_PMEM STREQUAL "yes")
MESSAGE(FATAL_ERROR "Can't find libpmem")
ENDIF()
UNSET(HAVE_LIBPMEM_H CACHE)
UNSET(LIBPMEM CACHE)
ELSEIF(NOT HAVE_LIBPMEM_H) ELSEIF(NOT HAVE_LIBPMEM_H)
MESSAGE(FATAL_ERROR "Can't find libpmem.h") IF(WITH_PMEM STREQUAL "yes")
MESSAGE(FATAL_ERROR "Can't find libpmem.h")
ENDIF()
UNSET(HAVE_LIBPMEM_H CACHE)
UNSET(LIBPMEM CACHE)
ELSE() ELSE()
ADD_DEFINITIONS(-DHAVE_PMEM) ADD_DEFINITIONS(-DHAVE_PMEM)
ENDIF() ENDIF()
ELSEIF(WITH_PMEM STREQUAL "no")
UNSET(HAVE_LIBPMEM_H CACHE)
UNSET(LIBPMEM CACHE)
ELSE()
MESSAGE(FATAL_ERROR "Invalid value for WITH_PMEM. Must be 'yes', 'no', or 'auto'.")
ENDIF() ENDIF()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment