# # @file CMakeLists.txt # # @brief Principal CMake configuration file # # @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 Nicolas Richart # @author Trach-Minh Tran # cmake_minimum_required (VERSION 2.8.8) project(futils) enable_language(Fortran) enable_testing() if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") include(futilsTools) if(NOT DEFINED FUTILS_EXAMPLES) option(FUTILS_EXAMPLES "Activates examples" ON) endif() # Installation root directory if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if($ENV{PREFIX}) set(${CMAKE_INSTALL_PREFIX} $ENV{PREFIX}) else() set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "..." FORCE) endif() message(STATUS "CMAKE_INSTALL_PREFIX is " ${CMAKE_INSTALL_PREFIX}) endif() # Require parallel-HDF5 and MPI find_package(HDF5 COMPONENTS Fortran REQUIRED) mark_as_advanced_prefix(HDF5_Fortran) find_package(MPI REQUIRED) # Is slurm installed? #find_path(SRUN srun) #if (EXISTS ${SRUN}) # set(MPIEXEC "${SRUN}/srun") # set(MPIEXEC_NUMPROC_FLAG "-n") #endif() #message("MPIEXEC is ${MPIEXEC}") #message("MPIEXEC_NUMPROC_FLAG is ${MPIEXEC_NUMPROC_FLAG}") if(NOT FUTILS_EXPORT_TARGETS) set(FUTILS_EXPORT_TARGETS futils-targets) endif() # Add futils source and examples/tests directories add_subdirectory(src) if(FUTILS_EXAMPLES) add_subdirectory(examples) endif() if(FUTILS_EXPORT_TARGETS MATCHES "futils-targets") # Create and install package configuration files configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/futils-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/futils-config.cmake @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/futils-config.cmake DESTINATION lib/cmake ) endif()