cmake-find/FindPreprocmath.cmake

46 lines
1.5 KiB
CMake

if(NOT PREPROCMATH_IS_EXTERNAL_PROJECT)
set(PREPROCMATH_PREFIX "" CACHE PATH "The path to the prefix of an libpreprocmath installation")
set(PREPROCMATH_INCLUDE_DIR "" CACHE PATH "The path to the headers of an libpreprocmath installation")
set(PREPROCMATH_LIBRARY_DIR "" CACHE PATH "The path to the library of an libpreprocmath installation")
set(_search_paths "")
if(PREPROCMATH_INCLUDE_DIR AND EXISTS ${PREPROCMATH_INCLUDE_DIR})
list(APPEND _search_paths ${PREPROCMATH_INCLUDE_DIR})
endif()
if(PREPROCMATH_PREFIX AND EXISTS ${PREPROCMATH_PREFIX})
list(APPEND _search_paths "${PREPROCMATH_PREFIX}/include")
endif()
find_path(
PREPROCMATH_INCLUDE_DIRS
NAMES preprocmath/params.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(PREPROCMATH_LIBRARY_DIR AND EXISTS ${PREPROCMATH_LIBRARY_DIR})
list(APPEND _search_paths ${PREPROCMATH_LIBRARY_DIR})
endif()
if(PREPROCMATH_PREFIX AND EXISTS ${PREPROCMATH_PREFIX})
list(APPEND _search_paths "${PREPROCMATH_PREFIX}/lib")
endif()
find_library(
PREPROCMATH_LIBRARIES
NAMES preprocmath
PATHS ${_search_paths})
unset(_search_paths)
if(PREPROCMATH_INCLUDE_DIRS AND PREPROCMATH_LIBRARIES)
set(PREPROCMATH_FOUND TRUE)
endif()
if(PREPROCMATH_FOUND)
if(NOT PREPROCMATH_FIND_QUIETLY)
message(STATUS "Found libpreprocmath")
endif()
set(HAVE_PREPROCMATH 1)
elseif(PREPROCMATH_FOUND)
if(PREPROCMATH_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libpreprocmath")
endif()
endif()
endif()