Skip to content

Commit

Permalink
Merge pull request #28 from andrsd/cmake-imps
Browse files Browse the repository at this point in the history
CMake improvements
  • Loading branch information
andrsd authored Jul 25, 2023
2 parents 2e86237 + b694928 commit 9dc9602
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
libhdf5-dev \
libexodusii-dev
echo "CODE_COVERAGE=YES" >> $GITHUB_ENV
cat /usr/include/exodusII.h
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos')
Expand Down
5 changes: 0 additions & 5 deletions cmake/exodusIIcppConfig.cmake

This file was deleted.

17 changes: 17 additions & 0 deletions cmake/exodusIIcppConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set(EXODUSIICPP_VERSION @PROJECT_VERSION@)

@PACKAGE_INIT@

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

check_required_components(exodusIIcpp)

find_library(EXODUSIICPP_LIBRARY NAMES exodusIIcpp HINTS ${PACKAGE_PREFIX_DIR}/lib NO_DEFAULT_PATH)
find_path(EXODUSIICPP_INCLUDE_DIR exodusIIcpp.h HINTS ${PACKAGE_PREFIX_DIR}/include/exodusIIcpp)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
exodusIIcpp
REQUIRED_VARS EXODUSIICPP_LIBRARY EXODUSIICPP_INCLUDE_DIR
VERSION_VAR EXODUSIICPP_VERSION
)
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ target_link_libraries(

# Install

configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/exodusIIcppConfig.cmake.in
exodusIIcppConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/exodusIIcpp
NO_SET_AND_CHECK_MACRO
)
write_basic_package_version_file(exodusIIcppConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
Expand Down Expand Up @@ -71,7 +77,7 @@ install(

install(
FILES
"${PROJECT_SOURCE_DIR}/cmake/exodusIIcppConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/exodusIIcppConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/exodusIIcppConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/exodusIIcpp
)

0 comments on commit 9dc9602

Please sign in to comment.