cmake-find/FindImitSrk.cmake
2022-05-24 16:56:25 +03:00

46 lines
1.4 KiB
CMake

if(NOT IMITSRK_IS_EXTERNAL_PROJECT)
set(IMITSRK_PREFIX "" CACHE PATH "The path to the prefix of an libimitsrk installation")
set(IMITSRK_INCLUDE_DIR "" CACHE PATH "The path to the headers of an libimitsrk installation")
set(IMITSRK_LIBRARY_DIR "" CACHE PATH "The path to the library of an libimitsrk installation")
set(_search_paths "")
if(IMITSRK_INCLUDE_DIR AND EXISTS ${IMITSRK_INCLUDE_DIR})
list(APPEND _search_paths ${IMITSRK_INCLUDE_DIR})
endif()
if(IMITSRK_PREFIX AND EXISTS ${IMITSRK_PREFIX})
list(APPEND _search_paths "${IMITSRK_PREFIX}/include")
endif()
find_path(
IMITSRK_INCLUDE_DIRS
NAMES imitsrk/imitator.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(IMITSRK_LIBRARY_DIR AND EXISTS ${IMITSRK_LIBRARY_DIR})
list(APPEND _search_paths ${IMITSRK_LIBRARY_DIR})
endif()
if(IMITSRK_PREFIX AND EXISTS ${IMITSRK_PREFIX})
list(APPEND _search_paths "${IMITSRK_PREFIX}/lib")
endif()
find_library(
IMITSRK_LIBRARIES
NAMES imitsrk
PATHS ${_search_paths})
unset(_search_paths)
if(IMITSRK_INCLUDE_DIRS AND IMITSRK_LIBRARIES)
set(IMITSRK_FOUND TRUE)
endif()
if(IMITSRK_FOUND)
if(NOT IMITSRK_FIND_QUIETLY)
message(STATUS "Found libimitsrk")
endif()
set(HAVE_IMITSRK 1)
elseif(IMITSRK_FOUND)
if(IMITSRK_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libimitsrk")
endif()
endif()
endif()