cmake-find/FindMyxlib.cmake

51 lines
1.4 KiB
CMake

if(NOT MYXLIB_IS_EXTERNAL_PROJECT)
set(MYXLIB_PREFIX "" CACHE PATH "The path to the prefix of an myxlib installation")
set(MYXLIB_INCLUDE_DIR "" CACHE PATH "The path to the headers of an myxlib installation")
set(MYXLIB_LIBRARY_DIR "" CACHE PATH "The path to the library of an myxlib installation")
set(_search_paths "")
if(EXISTS MYXLIB_INCLUDE_DIR)
list(APPEND _search_paths ${MYXLIB_INCLUDE_DIR})
endif()
if(EXISTS MYXLIB_PREFIX)
list(APPEND _search_paths ${MYXLIB_PREFIX}/include)
endif()
find_path(
MYXLIB_INCLUDE_DIRS
NAMES myx/core/config.hpp
PATHS ${_search_paths})
set(_search_paths "")
if(EXISTS MYXLIB_LIBRARY_DIR)
list(APPEND _search_paths ${MYXLIB_LIBRARY_DIR})
endif()
if(EXISTS MYXLIB_PREFIX)
list(APPEND _search_paths ${MYXLIB_PREFIX}/lib)
endif()
find_library(
MYXLIB_QT_LIBRARIES
NAMES myx-qt
PATHS ${_search_paths})
find_library(
MYXLIB_FILESYSTEM_LIBRARIES
NAMES myx-filesystem
PATHS ${_search_paths})
unset(_search_paths)
set(MYXLIB_LIBRARIES ${MYXLIB_QT_LIBRARIES} ${MYXLIB_FILESYSTEM_LIBRARIES})
if(MYXLIB_INCLUDE_DIRS AND MYXLIB_LIBRARIES)
set(MYXLIB_FOUND TRUE)
endif()
if(MYXLIB_FOUND)
if(NOT MYXLIB_FIND_QUIETLY)
message(STATUS "Found myxlib")
endif()
set(HAVE_MYXLIB 1)
elseif(MYXLIB_FOUND)
if(MYXLIB_FIND_REQUIRED)
message(FATAL_ERROR "Could not find myxlib")
endif()
endif()
endif()