Skip to content

Commit

Permalink
Merge pull request #3 from feelpp/master
Browse files Browse the repository at this point in the history
enable use of napp via cmake
  • Loading branch information
vincentchabannes authored Nov 12, 2024
2 parents 392d231 + 6e7b233 commit 16426de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_COMPILER=${{matrix.cxx-compiler}}
Expand Down
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(napp VERSION 0.1 LANGUAGES CXX)
project(napp VERSION 0.3 LANGUAGES CXX)

##
## MAIN_PROJECT CHECK
Expand All @@ -19,6 +19,7 @@ endif()

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(NAPP_TARGET_NAME ${PROJECT_NAME})
set(NAPP_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
if(NOT DEFINED NAPP_CONFIG_INSTALL_DIR )
Expand Down Expand Up @@ -91,8 +92,26 @@ install(
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NAPP_INCLUDE_INSTALL_DIR}
)
# Install CMake package configuration files
write_basic_package_version_file(
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" # Create this file as explained below
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)
install(
EXPORT ${NAPP_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)
install(
FILES
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake"
"${NAPP_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${NAPP_CONFIG_INSTALL_DIR}
)
3 changes: 3 additions & 0 deletions cmake/nappConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/nappTargets.cmake")

0 comments on commit 16426de

Please sign in to comment.