cmake-find/FindPreproc.cmake

46 lines
1.4 KiB
CMake

if(NOT PREPROC_IS_EXTERNAL_PROJECT)
set(PREPROC_PREFIX "" CACHE PATH "The path to the prefix of an libpreproc installation")
set(PREPROC_INCLUDE_DIR "" CACHE PATH "The path to the headers of an libpreproc installation")
set(PREPROC_LIBRARY_DIR "" CACHE PATH "The path to the library of an libpreproc installation")
set(_search_paths "")
if(PREPROC_INCLUDE_DIR AND EXISTS ${PREPROC_INCLUDE_DIR})
list(APPEND _search_paths ${PREPROC_INCLUDE_DIR})
endif()
if(PREPROC_PREFIX AND EXISTS ${PREPROC_PREFIX})
list(APPEND _search_paths "${PREPROC_PREFIX}/include")
endif()
find_path(
PREPROC_INCLUDE_DIRS
NAMES preproc/mark.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(PREPROC_LIBRARY_DIR AND EXISTS ${PREPROC_LIBRARY_DIR})
list(APPEND _search_paths ${PREPROC_LIBRARY_DIR})
endif()
if(PREPROC_PREFIX AND EXISTS ${PREPROC_PREFIX})
list(APPEND _search_paths "${PREPROC_PREFIX}/lib")
endif()
find_library(
PREPROC_LIBRARIES
NAMES preproc
PATHS ${_search_paths})
unset(_search_paths)
if(PREPROC_INCLUDE_DIRS AND PREPROC_LIBRARIES)
set(PREPROC_FOUND TRUE)
endif()
if(PREPROC_FOUND)
if(NOT PREPROC_FIND_QUIETLY)
message(STATUS "Found libpreproc")
endif()
set(HAVE_PREPROC 1)
elseif(PREPROC_FOUND)
if(PREPROC_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libpreproc")
endif()
endif()
endif()