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 ()