62 lines
1.8 KiB
CMake
62 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(math
|
|
VERSION "${HPR_PROJECT_VERSION}"
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
add_library(${PROJECT_NAME} INTERFACE)
|
|
add_library(${CMAKE_PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
|
add_module(${PROJECT_NAME})
|
|
|
|
file(GLOB ${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS
|
|
"../math.hpp" "*.hpp" "scalar/*.hpp" "vector/*.hpp" "matrix/*.hpp" "quaternion/*.hpp"
|
|
)
|
|
|
|
foreach(_header_path ${${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS})
|
|
list(APPEND ${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS_INTERFACE "$<BUILD_INTERFACE:${_header_path}>")
|
|
endforeach()
|
|
|
|
target_sources(${PROJECT_NAME}
|
|
INTERFACE
|
|
${${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS_INTERFACE}
|
|
$<INSTALL_INTERFACE:include/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}>
|
|
)
|
|
|
|
install(
|
|
TARGETS ${PROJECT_NAME}
|
|
EXPORT ${PROJECT_NAME}Targets
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
|
NAMELINK_SKIP
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
install(
|
|
EXPORT ${PROJECT_NAME}Targets
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}-${HPR_PROJECT_VERSION}
|
|
NAMESPACE ${CMAKE_PROJECT_NAME}::
|
|
)
|
|
install(
|
|
TARGETS ${PROJECT_NAME}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
|
NAMELINK_ONLY
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
install(
|
|
DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
|
|
COMPONENT devel
|
|
FILES_MATCHING
|
|
PATTERN "*.h"
|
|
PATTERN "*.hpp"
|
|
PATTERN "tests" EXCLUDE
|
|
)
|
|
install(
|
|
FILES ../${PROJECT_NAME}.hpp
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
|
|
COMPONENT devel
|
|
)
|
|
|
|
|
|
if(HPR_TEST)
|
|
add_subdirectory(tests)
|
|
endif() |