Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake #487

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Cmake #487

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fedora packaging convention
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Jun 11, 2024
commit 2371623022a2b0f8f65aac1f68ba24e99db619fb
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 7 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ target_link_libraries(Wannier90_lib PRIVATE
target_include_directories(Wannier90_lib PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_Fortran_MODULE_DIRECTORY}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_MODULEDIR}/Wannier90>"
)
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)
Expand All @@ -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 ()