vectorwrapper/CMakeLists.txt
King_DuckZ fcaa62d69f Fix copy-construction warning in clang
This bumps the c++ requirement to c++17
2021-04-08 15:01:42 +02:00

58 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(vectorwrapper VERSION 1.1.2)
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>
)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
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}
)