Generate a cmakefile for importing this library from other projects.

This commit is contained in:
King_DuckZ 2019-01-19 11:39:44 +00:00
parent 19b12600d8
commit 0ffa18c0cf

View file

@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_policy(SET CMP0048 NEW)
project(vectorwrapper VERSION 1.1.0) project(vectorwrapper VERSION 1.1.0)
if (BUILD_TESTS) if (BUILD_TESTS)
@ -12,6 +11,12 @@ configure_file(
@ONLY @ONLY
) )
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME}
INTERFACE $<INSTALL_INTERFACE:include>
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
)
install(DIRECTORY include/vectorwrapper install(DIRECTORY include/vectorwrapper
DESTINATION include DESTINATION include
PATTERN vectorwrapper.hpp.in EXCLUDE PATTERN vectorwrapper.hpp.in EXCLUDE
@ -19,3 +24,16 @@ install(DIRECTORY include/vectorwrapper
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper
DESTINATION include DESTINATION include
) )
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
PUBLIC_HEADER
DESTINATION include
CONFIGURATIONS Release
)
install(EXPORT ${PROJECT_NAME}
DESTINATION cmake/Modules
NAMESPACE vwr::
CONFIGURATIONS Release
)