myx-cmake/MyxCMake/find/FindImitator.cmake

46 lines
1.4 KiB
CMake
Raw Normal View History

2021-12-08 11:32:04 +00:00
if(NOT IMITATOR_IS_EXTERNAL_PROJECT)
set(IMITATOR_PREFIX "" CACHE PATH "The path to the prefix of an libimitator installation")
set(IMITATOR_INCLUDE_DIR "" CACHE PATH "The path to the headers of an libimitator installation")
set(IMITATOR_LIBRARY_DIR "" CACHE PATH "The path to the library of an libimitator installation")
set(_search_paths "")
if(IMITATOR_INCLUDE_DIR AND EXISTS ${IMITATOR_INCLUDE_DIR})
list(APPEND _search_paths ${IMITATOR_INCLUDE_DIR})
endif()
if(IMITATOR_PREFIX AND EXISTS ${IMITATOR_PREFIX})
list(APPEND _search_paths "${IMITATOR_PREFIX}/include")
endif()
find_path(
IMITATOR_INCLUDE_DIRS
NAMES imitator/imitator.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(IMITATOR_LIBRARY_DIR AND EXISTS ${IMITATOR_LIBRARY_DIR})
list(APPEND _search_paths ${IMITATOR_LIBRARY_DIR})
endif()
if(IMITATOR_PREFIX AND EXISTS ${IMITATOR_PREFIX})
list(APPEND _search_paths "${IMITATOR_PREFIX}/lib")
endif()
find_library(
IMITATOR_LIBRARIES
NAMES imitator
PATHS ${_search_paths})
unset(_search_paths)
if(IMITATOR_INCLUDE_DIRS AND IMITATOR_LIBRARIES)
set(IMITATOR_FOUND TRUE)
endif()
if(IMITATOR_FOUND)
if(NOT IMITATOR_FIND_QUIETLY)
message(STATUS "Found libimitator")
endif()
set(HAVE_IMITATOR 1)
elseif(IMITATOR_FOUND)
if(IMITATOR_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libimitator")
endif()
endif()
endif()