#
# @file CMakeLists.txt
#
# @brief
#
# @copyright
# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# SPC (Swiss Plasma Center)
#
# futils is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# futils is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
# @authors
# (in alphabetical order)
# @author Emmanuel Lanti
# @author Nicolas Richart
# @author Trach-Minh Tran
#
set(SRCS
futils.f90
buffer.f90
cutils.c
)
add_library(futils ${SRCS})
set_property(TARGET futils
PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/futils.mod
${CMAKE_CURRENT_BINARY_DIR}/hashtable.mod)
# MPI dependency
find_package(MPI COMPONENTS Fortran)
target_compile_options(futils PUBLIC ${MPI_Fortran_COMPILE_FLAGS})
target_link_libraries(futils
PUBLIC ${MPI_Fortran_LIBRARIES}
${HDF5_Fortran_LIBRARIES}
)
include(GNUInstallDirs)
target_include_directories(futils
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
${HDF5_Fortran_INCLUDE_DIRS}
${HDF5_Fortran_INCLUDE_DIR} # For backward compatibility with older versions of cmake
${MPI_Fortran_INCLUDE_PATH}
INTERFACE $
$
${HDF5_Fortran_INCLUDE_DIRS}
${HDF5_Fortran_INCLUDE_DIR}
${MPI_Fortran_INCLUDE_PATH}
)
install(TARGETS futils
EXPORT ${FUTILS_EXPORT_TARGETS}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
export(TARGETS futils
FILE "${CMAKE_BINARY_DIR}/futilsLibraryDepends.cmake")
export(PACKAGE futils)
if(FUTILS_EXPORT_TARGETS MATCHES "futils-targets")
install(EXPORT futils-targets
DESTINATION lib/cmake
)
endif()