From 4b2a52ed73ddee67ba4457c70669067711054122 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Thu, 22 Feb 2024 13:15:00 +0100 Subject: [PATCH] Fedora packaging convention Signed-off-by: Cristian Le --- CMakeLists.txt | 5 +++-- src/CMakeLists.txt | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf38ff6..6ead8efd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,10 +43,11 @@ if (WANNIER90_INSTALL) include(CMakePackageConfigHelpers) # CMake does not properly support fortran module installation paths. - # Adapting the standard from fortran-stdlib # https://gitlab.kitware.com/cmake/cmake/-/issues/19608 # https://discourse.cmake.org/t/api-design-c-modules-source-listings-and-interface-properties/5389/14 - cmake_path(APPEND CMAKE_INSTALL_INCLUDEDIR ${PROJECT_NAME} "${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}" + # Note: This does not follow fortran-stdlib format, instead it follows Fedora guidelines + # https://pagure.io/packaging-committee/issue/1334 + cmake_path(APPEND CMAKE_INSTALL_LIBDIR "${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}" modules OUTPUT_VARIABLE _DEFAULT_CMAKE_INSTALL_MODULEDIR ) set(CMAKE_INSTALL_MODULEDIR ${_DEFAULT_CMAKE_INSTALL_MODULEDIR} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e586473e..d2a2cba4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,10 +35,13 @@ target_link_libraries(Wannier90_lib PRIVATE target_include_directories(Wannier90_lib PUBLIC "$" "$" - "$" + "$" ) -target_sources(Wannier90_lib INTERFACE - FILE_SET wannier90_C_Headers TYPE HEADERS FILES wannier90.hh +target_sources(Wannier90_lib + INTERFACE FILE_SET wannier90_C_Headers TYPE HEADERS FILES + wannier90.hh + INTERFACE FILE_SET wannier90_Fortran_Headers TYPE HEADERS BASE_DIRS ${CMAKE_Fortran_MODULE_DIRECTORY} FILES + ${CMAKE_Fortran_MODULE_DIRECTORY}/w90_library.mod ) if (WANNIER90_MPI) target_link_libraries(Wannier90_lib PRIVATE MPI::MPI_Fortran) @@ -55,9 +58,6 @@ if (WANNIER90_INSTALL) PUBLIC_HEADER COMPONENT Wannier90_Development RUNTIME COMPONENT Wannier90_Runtime FILE_SET wannier90_C_Headers COMPONENT Wannier90_Development + FILE_SET wannier90_Fortran_Headers DESTINATION ${CMAKE_INSTALL_MODULEDIR}/Wannier90 COMPONENT Wannier90_Development ) - install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/w90_library.mod - DESTINATION ${CMAKE_INSTALL_MODULEDIR} - COMPONENT Wannier90_Development - ) endif ()