myx-cmake/MyxCMake/find/FindFsp.cmake

46 lines
1.2 KiB
CMake

if(NOT FSP_IS_EXTERNAL_PROJECT)
set(FSP_PREFIX "" CACHE PATH "The path to the prefix of an libfsp installation")
set(FSP_INCLUDE_DIR "" CACHE PATH "The path to the headers of an libfsp installation")
set(FSP_LIBRARY_DIR "" CACHE PATH "The path to the library of an libfsp installation")
set(_search_paths "")
if(FSP_INCLUDE_DIR AND EXISTS ${FSP_INCLUDE_DIR})
list(APPEND _search_paths ${FSP_INCLUDE_DIR})
endif()
if(FSP_PREFIX AND EXISTS ${FSP_PREFIX})
list(APPEND _search_paths "${FSP_PREFIX}/include")
endif()
find_path(
FSP_INCLUDE_DIRS
NAMES fsp/mods.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(FSP_LIBRARY_DIR AND EXISTS ${FSP_LIBRARY_DIR})
list(APPEND _search_paths ${FSP_LIBRARY_DIR})
endif()
if(FSP_PREFIX AND EXISTS ${FSP_PREFIX})
list(APPEND _search_paths "${FSP_PREFIX}/lib")
endif()
find_library(
FSP_LIBRARIES
NAMES fsp
PATHS ${_search_paths})
unset(_search_paths)
if(FSP_INCLUDE_DIRS AND FSP_LIBRARIES)
set(FSP_FOUND TRUE)
endif()
if(FSP_FOUND)
if(NOT FSP_FIND_QUIETLY)
message(STATUS "Found libfsp")
endif()
set(HAVE_FSP 1)
elseif(FSP_FOUND)
if(FSP_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libfsp")
endif()
endif()
endif()