vectorwrapper/CMakeLists.txt
2020-05-05 11:02:58 +02:00

57 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(vectorwrapper VERSION 1.1.1)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(CTest)
if (BUILD_TESTING)
add_subdirectory(test)
endif()
configure_file(
include/vectorwrapper/vectorwrapper.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper/vectorwrapper.hpp
@ONLY
)
write_basic_package_version_file(
${PROJECT_NAME}ConfigVersion.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
add_library(${PROJECT_NAME} INTERFACE)
add_library(vwr::vectorwrapper ALIAS vectorwrapper)
target_include_directories(${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
install(DIRECTORY include/vectorwrapper
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PATTERN vectorwrapper.hpp.in EXCLUDE
PATTERN meson.build EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT ${PROJECT_NAME}
FILE ${PROJECT_NAME}Config.cmake
NAMESPACE vwr::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)