Skip to content

Commit

Permalink
up install
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchabannes committed Nov 2, 2021
1 parent a8e3a34 commit 38ebfad
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ endif()

include(GNUInstallDirs)
set(NAPP_TARGET_NAME ${PROJECT_NAME})
set(NAPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(NAPP_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")# CACHE INTERNAL "")
set(NAPP_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NAPP_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(NAPP_CMAKE_PROJECT_TARGETS_FILE "${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake")


option(NAPP_ENABLE_TESTS "Build the unit tests when NAPP_ENABLE_TESTS is enabled." ${MAIN_PROJECT})
Expand All @@ -33,7 +38,7 @@ option(NAPP_ENABLE_DOC "Build the doc examples tests when NAPP_ENABLE_DOC
# message(STATUS "Using the single-header code from ${NAPP_INCLUDE_BUILD_DIR}")
# endif()

set(NAPP_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include")
set(NAPP_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/")


add_library(${NAPP_TARGET_NAME} INTERFACE)
Expand Down Expand Up @@ -61,3 +66,24 @@ endif()
if (NAPP_ENABLE_DOC)
add_subdirectory(doc)
endif()


install(
DIRECTORY ${NAPP_INCLUDE_BUILD_DIR}
DESTINATION ${NAPP_INCLUDE_INSTALL_DIR}
)
export(
TARGETS ${NAPP_TARGET_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE ${NAPP_CMAKE_PROJECT_TARGETS_FILE}
)
install(
TARGETS ${NAPP_TARGET_NAME}
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NAPP_INCLUDE_INSTALL_DIR}
)
install(
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)

0 comments on commit 38ebfad

Please sign in to comment.