# MODULES - modules to search using pkg_config
MACRO(ProcessPackage PKG_NAME)
- CMAKE_PARSE_ARGUMENTS(PKG "OPTIONAL" "ROOT;INCLUDE"
+ CMAKE_PARSE_ARGUMENTS(PKG "OPTIONAL;OPTIONAL_INCLUDE" "ROOT;INCLUDE"
"LIBRARY;INCLUDE_SUFFIXES;LIB_SUFFIXES;MODULES;LIB_OUTPUT" ${ARGN})
IF(NOT PKG_LIBRARY)
PATH_SUFFIXES ${PKG_INCLUDE_SUFFIXES} include
PATHS {RSPAMD_DEFAULT_INCLUDE_PATHS})
IF(NOT _incl)
- IF(PKG_OPTIONAL)
+ IF(PKG_OPTIONAL OR PKG_OPTIONAL_INCLUDE)
MESSAGE(STATUS "Cannot find header ${PKG_INCLUDE} for package ${PKG_NAME}")
ELSE()
MESSAGE(FATAL_ERROR "Cannot find header ${PKG_INCLUDE} for package ${PKG_NAME}")
ENDIF()
+ ELSE()
+ STRING(REGEX REPLACE "/[^/]+$" "" _incl_path "${PKG_INCLUDE}")
+ STRING(REGEX REPLACE "${_incl_path}/$" "" _stripped_incl "${_incl}")
+ INCLUDE_DIRECTORIES("${_stripped_incl}")
+ SET(${PKG_NAME}_INCLUDE "${_stripped_incl}" CACHE INTERNAL "")
ENDIF(NOT _incl)
- IF(_incl AND _lib)
+ IF(_lib)
# We need to apply heuristic to find the real dir name
- STRING(REGEX REPLACE "/[^/]+$" "" _incl_path "${PKG_INCLUDE}")
- STRING(REGEX REPLACE "${_incl_path}/$" "" _stripped_incl "${_incl}")
GET_FILENAME_COMPONENT(_lib_path "${_lib}" PATH)
- INCLUDE_DIRECTORIES("${_stripped_incl}")
LINK_DIRECTORIES("${_lib_path}")
LIST(APPEND ${PKG_LIB_OUTPUT} ${_lib})
- SET(${PKG_NAME}_INCLUDE "${_stripped_incl}" CACHE INTERNAL "")
SET(${PKG_NAME}_LIBRARY_PATH "${_lib_path}" CACHE INTERNAL "")
SET(${PKG_NAME}_LIBRARY "${_lib}" CACHE INTERNAL "")
+ ENDIF()
+
+ IF(_incl AND _lib)
+ MESSAGE(STATUS "Found package ${PKG_NAME} in '${_lib_path}' (${_lib}) and '${_stripped_incl}' (${PKG_INCLUDE}).")
SET(${PKG_NAME}_GUESSED 1 CACHE INTERNAL "")
SET(WITH_${PKG_NAME} 1 CACHE INTERNAL "")
- MESSAGE(STATUS "Found package ${PKG_NAME} in '${_lib_path}' (${_lib}) and '${_stripped_incl}' (${PKG_INCLUDE}).")
+ ELSEIF(_lib)
+ IF(PKG_OPTIONAL_INCLUDE)
+ SET(${PKG_NAME}_GUESSED 1 INTERNAL "")
+ SET(WITH_${PKG_NAME} 1 INTERNAL "")
+ ENDIF()
+ MESSAGE(STATUS "Found incomplete package ${PKG_NAME} in '${_lib_path}' (${_lib}); no includes.")
ENDIF()
-
ELSE()
MESSAGE(STATUS "Found package ${PKG_NAME} (cached)")
INCLUDE_DIRECTORIES("${${PKG_NAME}_INCLUDE}")
ROOT ${LIBSODIUM_ROOT_DIR} MODULES libsodium>=1.0.0)
IF(ENABLE_BLAS MATCHES "ON")
-ProcessPackage(BLAS LIBRARY openblas blas
+ProcessPackage(BLAS OPTIONAL_INCLUDE LIBRARY openblas blas
INCLUDE cblas.h INCLUDE_SUFFIXES include/openblas
include/blas
ROOT ${BLAS_ROOT_DIR}