Skip to content

Commit

Permalink
Use GNUInstallDirs to fix installation problems on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrady committed Oct 16, 2023
1 parent 7395ed5 commit d5896fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ if (PARTHENON_ENABLE_ASCENT)
find_package(Ascent REQUIRED NO_DEFAULT_PATH)
endif()

# Installation configuration
include(GNUInstallDirs)

add_subdirectory(src)
add_subdirectory(example)
add_subdirectory(benchmarks)
Expand Down
10 changes: 10 additions & 0 deletions cmake/parthenonConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
# the public, perform publicly and display publicly, and to permit others to do so.
#=========================================================================================

if(NOT PARTHENON_CMAKE)
cmake_path(SET PARTHENON_CMAKE_BASE_DIR NORMALIZE "${CMAKE_CURRENT_LIST_DIR}/..")
message(STATUS "Appending parthenon cmake module directory: " ${PARTHENON_CMAKE_BASE_DIR})
list(APPEND CMAKE_MODULE_PATH ${PARTHENON_CMAKE_BASE_DIR})
set(PARTHENON_CMAKE TRUE)
endif()


# Favor using the kokkos package that was built with parthenon, if one has not been specified
if (@PARTHENON_IMPORT_KOKKOS@)
find_package(Kokkos 3 REQUIRED PATHS @Kokkos_DIR@ NO_DEFAULT_PATH)
Expand All @@ -37,4 +45,6 @@ if(@OpenMP_FOUND@)
find_package(OpenMP REQUIRED COMPONENTS CXX)
endif()

find_package(Filesystem REQUIRED COMPONENTS Experimental Final)

include("${CMAKE_CURRENT_LIST_DIR}/parthenonTargets.cmake")
8 changes: 3 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,7 @@ target_include_directories(parthenon PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/parthenon>
)

install(TARGETS parthenon EXPORT parthenonTargets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parthenon"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install(TARGETS parthenon EXPORT parthenonTargets)

# Maintain directory structure in installed include files
install(DIRECTORY . DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/parthenon" FILES_MATCHING PATTERN "*.hpp")
Expand All @@ -343,6 +339,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/config.hpp

install(FILES ${PROJECT_BINARY_DIR}/cmake/parthenonConfig.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/parthenon")

install(FILES ${PROJECT_SOURCE_DIR}/cmake/FindFilesystem.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake")

install(EXPORT parthenonTargets
FILE parthenonTargets.cmake
NAMESPACE Parthenon::
Expand Down

0 comments on commit d5896fe

Please sign in to comment.