cmake_minimum_required(VERSION 3.15)
project(linmath-header C)
add_library(linmath INTERFACE)
target_include_directories(linmath INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
                                          $<INSTALL_INTERFACE:include>)
include(CTest)
if (BUILD_TESTING)
  add_executable(linmath_test tests/linmath_test.c)
  target_include_directories(linmath_test PRIVATE include tests)
  add_test(NAME linmath_test COMMAND linmath_test)
endif()
install(DIRECTORY include/ DESTINATION include)
install(TARGETS linmath EXPORT linmathTargets)
install(EXPORT linmathTargets NAMESPACE linmath:: DESTINATION lib/cmake/linmath)
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/linmathConfigVersion.cmake"
  VERSION 0.1.0 COMPATIBILITY AnyNewerVersion)
configure_file(packaging/pkgconfig/linmath.pc.in linmath.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/linmath.pc" DESTINATION lib/pkgconfig)
