Skip to content

Commit

Permalink
Use standard GNU installation paths
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Oct 13, 2020
1 parent 79d8ca3 commit 10ac0b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ install(
${CMAKE_CURRENT_BINARY_DIR}/cmake/mpifx-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mpifx)

GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_MODULEDIR CMAKE_INSTALL_MODULEDIR)

get_pkgconfig_params(PKGCONFIG_REQUIRES PKGCONFIG_LIBS PKGCONFIG_LIBS_PRIVATE PKGCONFIG_C_FLAGS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utils/export/mpifx.pc.in
${CMAKE_CURRENT_BINARY_DIR}/mpifx.pc @ONLY)
Expand Down
2 changes: 1 addition & 1 deletion cmake/MpiFxUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function(get_pkgconfig_params pkgconfig_requires pkgconfig_libs pkgconfig_libs_p

set(_pkgconfig_libs_private "${CMAKE_EXE_LINKER_FLAGS}")

set(_pkgconfig_c_flags "-I${CMAKE_INSTALL_FULL_MODULEDIR}")
set(_pkgconfig_c_flags "-I${CMAKE_INSTALL_FULL_INCLUDEDIR}/${INSTALL_MODULEDIR}")

set(${pkgconfig_requires} "${_pkgconfig_requires}" PARENT_SCOPE)
set(${pkgconfig_libs} "${_pkgconfig_libs}" PARENT_SCOPE)
Expand Down
10 changes: 4 additions & 6 deletions config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ option(INSTALL_INCLUDE_FILES "Whether include / module files should be installed
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/_install" CACHE STRING
"Directory to install the compiled code into")

#set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INCLUDEDIR "mpifx" CACHE PATH
"Installation directory for header and include files (within standard include folder)")

set(CMAKE_INSTALL_INCLUDEDIR "include/mpifx" CACHE PATH
"Installation directory for header and include files")

set(CMAKE_INSTALL_MODULEDIR "${CMAKE_INSTALL_INCLUDEDIR}/modfiles" CACHE PATH
"Installation directory for Fortran module files")
set(INSTALL_MODULEDIR "${INSTALL_INCLUDEDIR}/modfiles" CACHE PATH
"Installation directory for Fortran module files (within standard include folder)")
4 changes: 2 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ set_target_properties(mpifx PROPERTIES Fortran_MODULE_DIRECTORY ${BUILD_MOD_DIR}

target_include_directories(mpifx PUBLIC
$<BUILD_INTERFACE:${BUILD_MOD_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_MODULEDIR}>)

install(TARGETS mpifx
EXPORT mpifx-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if(INSTALL_INCLUDE_FILES)
install(DIRECTORY ${BUILD_MOD_DIR}/ DESTINATION ${CMAKE_INSTALL_MODULEDIR})
install(DIRECTORY ${BUILD_MOD_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${INSTALL_MODULEDIR})
endif()

0 comments on commit 10ac0b4

Please sign in to comment.