Improve install

This commit is contained in:
King_DuckZ 2020-05-05 11:02:58 +02:00
parent 965caeee7b
commit af7fe9f1fa
2 changed files with 17 additions and 10 deletions

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(vectorwrapper VERSION 1.1.1)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
include(CTest)
if (BUILD_TESTING)
@ -18,7 +18,8 @@ configure_file(
write_basic_package_version_file(
${PROJECT_NAME}ConfigVersion.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
add_library(${PROJECT_NAME} INTERFACE)
@ -29,27 +30,28 @@ target_include_directories(${PROJECT_NAME}
)
install(DIRECTORY include/vectorwrapper
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PATTERN vectorwrapper.hpp.in EXCLUDE
PATTERN meson.build EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/vectorwrapper
DESTINATION include
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
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 lib/cmake/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

View file

@ -4,6 +4,8 @@ project('vectorwrapper', 'cpp',
default_options:['cpp_std=c++11', 'b_ndebug=if-release']
)
pkg = import('pkgconfig')
public_includes = include_directories('include')
subdir('include/vectorwrapper')
@ -28,6 +30,9 @@ install_headers(
subdir: 'vectorwrapper',
)
vwr_lib = library(meson.project_name(), dependencies: [vectorwrapper_dep])
pkg.generate(vwr_lib)
if get_option('build_testing')
subdir('test')
endif