mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 05:05:32 +02:00
Change Find*.cmake modules to match conventions
This commit is contained in:
parent
9e32f229d4
commit
c356714d77
11 changed files with 65 additions and 46 deletions
|
@ -1,7 +1,7 @@
|
|||
find_path(LIBAIO_INCLUDE_DIR NAMES libaio.h)
|
||||
find_path(LIBAIO_INCLUDE_DIRS NAMES libaio.h)
|
||||
find_library(LIBAIO_LIBRARIES NAMES aio)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
LIBAIO DEFAULT_MSG
|
||||
LIBAIO_LIBRARIES LIBAIO_INCLUDE_DIR)
|
||||
LIBAIO_LIBRARIES LIBAIO_INCLUDE_DIRS)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
|
||||
find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
|
||||
find_library(LZ4_LIBRARIES NAMES lz4)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
LZ4 DEFAULT_MSG
|
||||
LZ4_LIBRARIES LZ4_INCLUDE_DIR)
|
||||
LZ4_LIBRARIES LZ4_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARIES)
|
||||
mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES)
|
||||
|
|
9
cmake/FindLZO.cmake
Normal file
9
cmake/FindLZO.cmake
Normal file
|
@ -0,0 +1,9 @@
|
|||
find_path(LZO_INCLUDE_DIRS NAMES lzo/lzo1x.h)
|
||||
find_library(LZO_LIBRARIES NAMES lzo2)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
LZO DEFAULT_MSG
|
||||
LZO_LIBRARIES LZO_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(LZO_INCLUDE_DIRS LZO_LIBRARIES)
|
|
@ -7,12 +7,12 @@ if(DEFINED PMEM_LIBRARIES)
|
|||
return()
|
||||
endif()
|
||||
|
||||
find_path(PMEM_INCLUDE_DIR NAMES libpmem.h)
|
||||
find_path(PMEM_INCLUDE_DIRS NAMES libpmem.h)
|
||||
find_library(PMEM_LIBRARIES NAMES pmem)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
PMEM DEFAULT_MSG
|
||||
PMEM_LIBRARIES PMEM_INCLUDE_DIR)
|
||||
PMEM_LIBRARIES PMEM_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(PMEM_INCLUDE_DIR PMEM_LIBRARIES)
|
||||
mark_as_advanced(PMEM_INCLUDE_DIRS PMEM_LIBRARIES)
|
||||
|
|
9
cmake/FindSnappy.cmake
Normal file
9
cmake/FindSnappy.cmake
Normal file
|
@ -0,0 +1,9 @@
|
|||
find_path(SNAPPY_INCLUDE_DIRS NAMES snappy.h)
|
||||
find_library(SNAPPY_LIBRARIES NAMES snappy)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
Snappy DEFAULT_MSG
|
||||
SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(SNAPPY_INCLUDE_DIRS SNAPPY_LIBRARIES)
|
|
@ -1,9 +1,9 @@
|
|||
find_path(URING_INCLUDE_DIR NAMES liburing.h)
|
||||
find_path(URING_INCLUDE_DIRS NAMES liburing.h)
|
||||
find_library(URING_LIBRARIES NAMES uring)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
URING DEFAULT_MSG
|
||||
URING_LIBRARIES URING_INCLUDE_DIR)
|
||||
URING_LIBRARIES URING_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(URING_INCLUDE_DIR URING_LIBRARIES)
|
||||
mark_as_advanced(URING_INCLUDE_DIRS URING_LIBRARIES)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# - Find zstd
|
||||
# Find the zstd compression library and includes
|
||||
#
|
||||
# ZSTD_INCLUDE_DIR - where to find zstd.h, etc.
|
||||
# ZSTD_INCLUDE_DIRS - where to find zstd.h, etc.
|
||||
# ZSTD_LIBRARIES - List of libraries when using zstd.
|
||||
# ZSTD_FOUND - True if zstd found.
|
||||
|
||||
find_path(ZSTD_INCLUDE_DIR
|
||||
find_path(ZSTD_INCLUDE_DIRS
|
||||
NAMES zstd.h
|
||||
HINTS ${ZSTD_ROOT_DIR}/include)
|
||||
|
||||
|
@ -14,8 +14,8 @@ find_library(ZSTD_LIBRARIES
|
|||
HINTS ${ZSTD_ROOT_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
|
||||
find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(
|
||||
ZSTD_LIBRARIES
|
||||
ZSTD_INCLUDE_DIR)
|
||||
ZSTD_INCLUDE_DIRS)
|
||||
|
|
|
@ -122,6 +122,7 @@ IF(NOT PLUGIN_S3 STREQUAL NO)
|
|||
ENDIF()
|
||||
|
||||
IF (CURL_FOUND)
|
||||
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${PC_CURL_LIBDIR})
|
||||
MYSQL_ADD_PLUGIN(s3 ha_s3.cc ${S3_SOURCES} COMPONENT s3-engine
|
||||
LINK_LIBRARIES curl z STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# Once done this will define
|
||||
#
|
||||
# Judy_FOUND - system has Judy
|
||||
# Judy_INCLUDE_DIR - the Judy include directory
|
||||
# Judy_INCLUDE_DIRS - the Judy include directory
|
||||
# Judy_LIBRARIES - Link these to use Judy
|
||||
# Judy_DEFINITIONS - Compiler switches required for using Judy
|
||||
|
||||
|
@ -24,21 +24,21 @@ IF(MSVC)
|
|||
# For now, assume Judy built according to the above instructions
|
||||
if (NOT "$ENV{JUDY_ROOT}" STREQUAL "")
|
||||
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
|
||||
string(REPLACE "\\" "/" Judy_INCLUDE_DIR_search $ENV{JUDY_ROOT}/src)
|
||||
string(REPLACE "\\" "/" Judy_INCLUDE_DIRS_search $ENV{JUDY_ROOT}/src)
|
||||
string(REPLACE "\\" "/" Judy_LIBRARIES_search $ENV{JUDY_ROOT}/src)
|
||||
endif()
|
||||
ELSE(MSVC)
|
||||
IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
||||
IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
|
||||
SET(Judy_FIND_QUIETLY TRUE)
|
||||
ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
||||
ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
|
||||
ENDIF(MSVC)
|
||||
|
||||
FIND_PATH(Judy_INCLUDE_DIR Judy.h PATHS ${Judy_INCLUDE_DIR_search})
|
||||
FIND_PATH(Judy_INCLUDE_DIRS Judy.h PATHS ${Judy_INCLUDE_DIRS_search})
|
||||
FIND_LIBRARY(Judy_LIBRARIES Judy PATHS ${Judy_LIBRARIES_search})
|
||||
|
||||
IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
||||
IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
|
||||
SET(Judy_FOUND TRUE)
|
||||
ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
||||
ELSE (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
|
||||
SET(Judy_FOUND FALSE)
|
||||
if (MSVC)
|
||||
MESSAGE(STATUS "How to build Judy on Windows:")
|
||||
|
@ -51,7 +51,7 @@ ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
|||
MESSAGE(STATUS "3. Execute the command: 'build'")
|
||||
MESSAGE(STATUS "4. Rerun this cmake with the environment variable: 'set JUDY_ROOT=x:\\path\\to\\judy'")
|
||||
endif(MSVC)
|
||||
ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
|
||||
ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
|
||||
|
||||
IF (Judy_FOUND)
|
||||
IF (NOT Judy_FIND_QUIETLY)
|
||||
|
@ -63,5 +63,5 @@ ELSE (Judy_FOUND)
|
|||
ENDIF (Judy_FIND_REQUIRED)
|
||||
ENDIF (Judy_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(Judy_INCLUDE_DIR Judy_LIBRARIES)
|
||||
MARK_AS_ADVANCED(Judy_INCLUDE_DIRS Judy_LIBRARIES)
|
||||
|
||||
|
|
|
@ -35,48 +35,48 @@ endif()
|
|||
# Optional compression libraries.
|
||||
|
||||
include(CheckFunctionExists)
|
||||
macro(check_lib package var)
|
||||
STRING(TOUPPER ${package} PACKAGE_NAME)
|
||||
macro(check_lib package)
|
||||
SET(WITH_ROCKSDB_${package} AUTO CACHE STRING
|
||||
"Build RocksDB with ${package} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
|
||||
|
||||
STRING(TOUPPER ${package} var)
|
||||
IF (NOT ${WITH_ROCKSDB_${package}} STREQUAL "OFF")
|
||||
FIND_PACKAGE(${package} QUIET)
|
||||
SET(HAVE_ROCKSDB_${PACKAGE_NAME} TRUE)
|
||||
IF (${${PACKAGE_NAME}_FOUND})
|
||||
IF(${ARGC} GREATER 2)
|
||||
SET(HAVE_ROCKSDB_${package} TRUE)
|
||||
IF (${${package}_FOUND})
|
||||
IF(${ARGC} GREATER 1)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${${var}_LIBRARIES})
|
||||
CHECK_FUNCTION_EXISTS(${ARGV2} ${var}_VALID)
|
||||
CHECK_FUNCTION_EXISTS(${ARGV1} ${package}_VALID)
|
||||
UNSET(CMAKE_REQUIRED_LIBRARIES)
|
||||
ELSE()
|
||||
SET(${var}_VALID TRUE)
|
||||
SET(${package}_VALID TRUE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(ROCKSDB_${PACKAGE_NAME} HAVE_ROCKSDB_${PACKAGE_NAME} "${package} Compression in the RocksDB storage engine")
|
||||
ADD_FEATURE_INFO(ROCKSDB_${package} HAVE_ROCKSDB_${package} "${package} Compression in the RocksDB storage engine")
|
||||
|
||||
IF(${${var}_VALID})
|
||||
MESSAGE_ONCE(rocksdb_${var} "Found ${package}: ${${var}_LIBRARIES}")
|
||||
add_definitions(-D${PACKAGE_NAME})
|
||||
IF(${${package}_VALID})
|
||||
MESSAGE_ONCE(rocksdb_${package} "Found ${package}: ${${var}_LIBRARIES}")
|
||||
add_definitions(-D${var})
|
||||
include_directories(${${var}_INCLUDE_DIR})
|
||||
list(APPEND THIRDPARTY_LIBS ${${var}_LIBRARIES})
|
||||
ELSEIF(${${PACKAGE_NAME}_FOUND})
|
||||
MESSAGE_ONCE(rocksdb_${var} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV2}]")
|
||||
ELSEIF(${${package}_FOUND})
|
||||
MESSAGE_ONCE(rocksdb_${package} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV1}]")
|
||||
ELSE()
|
||||
MESSAGE_ONCE(rocksdb_${var} "Could NOT find ${package}")
|
||||
MESSAGE_ONCE(rocksdb_${package} "Could NOT find ${package}")
|
||||
ENDIF()
|
||||
|
||||
IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${PACKAGE_NAME}_FOUND})
|
||||
IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${package}_FOUND})
|
||||
MESSAGE(FATAL_ERROR
|
||||
"${package} library was not found, but WITH_ROCKSDB_${package} option is ON.\
|
||||
Either set WITH_ROCKSDB_${package} to OFF, or make sure ${package} is installed")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
check_lib(LZ4 LZ4)
|
||||
check_lib(BZip2 BZIP2)
|
||||
check_lib(snappy snappy) # rocksdb/cmake/modules/Findsnappy.cmake violates the convention
|
||||
check_lib(ZSTD ZSTD ZDICT_trainFromBuffer)
|
||||
check_lib(LZ4)
|
||||
check_lib(BZip2)
|
||||
check_lib(Snappy)
|
||||
check_lib(ZSTD ZDICT_trainFromBuffer)
|
||||
|
||||
add_definitions(-DZLIB)
|
||||
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
|
||||
|
|
|
@ -15,11 +15,11 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
|
||||
ADD_DEFINITIONS(-DHAVE_URING)
|
||||
LINK_LIBRARIES(${URING_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${URING_INCLUDE_DIRS})
|
||||
SET(EXTRA_SOURCES aio_liburing.cc)
|
||||
SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIRS})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${URING_LIBRARIES})
|
||||
CHECK_SYMBOL_EXISTS(io_uring_mlock_size "liburing.h" HAVE_IO_URING_MLOCK_SIZE)
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
|
||||
|
@ -32,7 +32,7 @@ ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
IF(LIBAIO_FOUND)
|
||||
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
|
||||
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
|
||||
INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIRS})
|
||||
LINK_LIBRARIES(${LIBAIO_LIBRARIES})
|
||||
SET(EXTRA_SOURCES aio_linux.cc)
|
||||
ENDIF()
|
||||
|
|
Loading…
Add table
Reference in a new issue