ImitSrk
This commit is contained in:
parent
c2b09e5cb2
commit
505d39faaf
45
FindImitSrk.cmake
Normal file
45
FindImitSrk.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
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()
|
42
FindImitSrkThirdparty.cmake
Normal file
42
FindImitSrkThirdparty.cmake
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Подключение внешних проектов
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
set(IMITSRK_PREFIX
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
CACHE FILEPATH "" FORCE)
|
||||||
|
set(IMITSRK_INCLUDE_DIR
|
||||||
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
CACHE PATH "" FORCE)
|
||||||
|
set(IMITSRK_INCLUDE_DIRS
|
||||||
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
CACHE PATH "" FORCE)
|
||||||
|
set(IMITSRK_LIBRARY_DIR
|
||||||
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
|
||||||
|
CACHE PATH "" FORCE)
|
||||||
|
set(IMITSRK_LIBRARIES
|
||||||
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libimitsrk.a
|
||||||
|
CACHE FILEPATH "" FORCE)
|
||||||
|
|
||||||
|
# cmake-format: off
|
||||||
|
list(APPEND _ext_project_args
|
||||||
|
libimitsrk
|
||||||
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libimitsrk
|
||||||
|
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||||
|
CMAKE_ARGS ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
|
||||||
|
-DIMITATOR_PREFIX=${CMAKE_BINARY_DIR}
|
||||||
|
-DPREPROCMATH_PREFIX=${CMAKE_BINARY_DIR}
|
||||||
|
-DMYXLIB_PREFIX=${CMAKE_BINARY_DIR}
|
||||||
|
<SOURCE_DIR>)
|
||||||
|
if(ImitSrkThirdparty_FIND_COMPONENTS STREQUAL "headers")
|
||||||
|
list(APPEND _ext_project_args
|
||||||
|
BUILD_COMMAND true
|
||||||
|
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} imitsrk-install-headers)
|
||||||
|
else()
|
||||||
|
list(APPEND _ext_project_args
|
||||||
|
BUILD_BYPRODUCTS ${IMITSRK_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
ExternalProject_Add(${_ext_project_args})
|
||||||
|
unset(_ext_project_args)
|
||||||
|
|
||||||
|
set(IMITSRK_IS_EXTERNAL_PROJECT ON CACHE BOOL "" FORCE)
|
||||||
|
# cmake-format: on
|
Loading…
Reference in New Issue
Block a user