vectorwrapper/CMakeLists.txt
King_DuckZ 2e30692071 Fix cmake files so client projects can link to the interface target.
This way they can link to vwr::vectorwrapper to have the
correct include path added.
2020-04-07 23:53:19 +02:00

55 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(vectorwrapper VERSION 1.1.0)
include(CMakePackageConfigHelpers)
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 AnyNewerVersion
)
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 include
PATTERN vectorwrapper.hpp.in EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper
DESTINATION include
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/${PROJECT_NAME}
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
install(EXPORT ${PROJECT_NAME}
FILE ${PROJECT_NAME}Config.cmake
NAMESPACE vwr::
DESTINATION lib/cmake/${PROJECT_NAME}
)