Preprocmath

This commit is contained in:
Andrei Astafev 2021-06-23 01:17:57 +03:00
parent aa9e44b01f
commit 4487851535
2 changed files with 68 additions and 0 deletions

29
FindPreprocmath.cmake Normal file
View File

@ -0,0 +1,29 @@
if(NOT LIBPREPROCMATH_PREFIX STREQUAL CMAKE_BINARY_DIR)
set(LIBPREPROCMATH_PREFIX "" CACHE PATH "The path to the previx of an libpreprocmath installation")
find_path(
LIBPREPROCMATH_INCLUDE_DIRS
NAMES preprocmath/params.hpp
PATHS ${LIBPREPROCMATH_PREFIX}/include)
find_library(
LIBPREPROCMATH_LIBRARY
NAMES preprocmath
PATHS ${LIBPREPROCMATH_PREFIX}/lib)
if(LIBPREPROCMATH_INCLUDE_DIRS AND LIBPREPROCMATH_LIBRARY)
get_filename_component(LIBPREPROCMATH_LIBRARY_DIR ${LIBPREPROCMATH_LIBRARY}
DIRECTORY CACHE)
set(LIBPREPROCMATH_FOUND TRUE)
endif()
if(LIBPREPROCMATH_FOUND)
if(NOT LIBPREPROCMATH_FIND_QUIETLY)
message(STATUS "Found libpreprocmath")
endif()
set(HAVE_LIBPREPROCMATH 1)
elseif(LIBPREPROCMATH_FOUND)
if(LIBPREPROCMATH_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libpreprocmath")
endif()
endif()
endif()

View File

@ -0,0 +1,39 @@
# Подключение внешних проектов
include(ExternalProject)
if(${PreprocmathThirdparty_FIND_COMPONENTS} STREQUAL "headers")
ExternalProject_Add(
libpreprocmath
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libpreprocmath
INSTALL_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND
${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
-DCMLIB_MAIN_DIR=${CMLIB_MAIN_DIR} ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
<SOURCE_DIR>
BUILD_COMMAND true
INSTALL_COMMAND make preprocmath-install-headers)
else()
ExternalProject_Add(
libpreprocmath
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libpreprocmath
INSTALL_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND
${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
-DCMLIB_MAIN_DIR=${CMLIB_MAIN_DIR} ${CMLIB_EXT_PROJ_DEFAULT_ARGS}
<SOURCE_DIR>)
endif()
set(LIBPREPROCMATH_PREFIX
${CMAKE_BINARY_DIR}
CACHE FILEPATH "" FORCE)
set(LIBPREPROCMATH_INCLUDE_DIRS
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
CACHE PATH "" FORCE)
set(LIBPREPROCMATH_LIBRARY_DIR
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
CACHE PATH "" FORCE)
set(LIBPREPROCMATH_LIBRARY
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libpreprocmath.a
CACHE FILEPATH "" FORCE)