[A] Add target export in cmake.

This commit is contained in:
seleznevae 2020-02-09 13:02:25 +03:00
parent bff48549de
commit c22a518766
2 changed files with 19 additions and 6 deletions

View File

@ -15,6 +15,7 @@
### Internal
- Refactoring of code that uses vectors.
- Add target export in cmake.
### Docs

View File

@ -6,7 +6,8 @@ add_library(fort
target_include_directories(fort
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(fort
@ -30,14 +31,25 @@ endif()
include(GNUInstallDirs)
install(
TARGETS
fort
TARGETS fort
EXPORT LibFort
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(FILES fort.h fort.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
FILES fort.h fort.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
configure_file(libfort.pc.in libfort.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libfort.pc DESTINATION lib/pkgconfig)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libfort.pc
DESTINATION lib/pkgconfig
)
install(
EXPORT LibFort
NAMESPACE LibFort::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)