diff --git a/CMakeLists.txt b/CMakeLists.txt index 51da9d1..6846f18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,118 +1,129 @@ cmake_minimum_required (VERSION 2.8.8) #cmake_policy(SET CMP0053 NEW) project(SPClibs Fortran C) option(SPCLIBS_TEST "Activate tests for SPClibs" OFF) option(SPCLIBS_USE_MUMPS "Activate the mumps interface" OFF) option(SPCLIBS_USE_LAPACK "Activate the lapack interface" OFF) option(SPCLIBS_USE_PETSC "Activate the petsc interface" OFF) option(SPCLIBS_USE_SCALAPACK "Activate the scalapack interface" OFF) +option(SPCLIBS_USE_FFTW3 "Activate the FFTW3 interface" OFF) option(SPCLIBS_EXAMPLES "Compiles the examples" OFF) -if(${SPCLIBS_TEST}) +if(SPCLIBS_TEST) enable_testing() endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() include(CMakeFlagsHandling) # Compiler flags for debug/optimization if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(CMAKE_AR ${XIAR}) add_flags(LANG Fortran TYPE DEBUG -traceback "-check bounds" "-warn unused") add_flags(LANG Fortran TYPE RELEASE -xHost) elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") add_flags(LANG Fortran TYPE DEBUG -fbounds-check -fbacktrace) endif() # Installation root directory if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(PREFIX $ENV{PREFIX}) if(PREFIX) set(${CMAKE_INSTALL_PREFIX} ${PREFIX}) else() set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "..." FORCE) endif() message(STATUS "CMAKE_INSTALL_PREFIX is " ${CMAKE_INSTALL_PREFIX}) endif() # Search and load the FUTILS configuration file if(NOT TARGET futils) find_package(futils PATHS ${FUTILS}/lib/cmake REQUIRED) endif() if(SPCLIBS_USE_MUMPS) find_package(Mumps REQUIRED) set(HAS_MUMPS ${MUMPS_FOUND}) else() set(HAS_MUMPS FALSE) endif() if(SPCLIBS_USE_PETSC) find_package(PETSc REQUIRED) set(HAS_PETSC ${PETSC_FOUND}) else() set(HAS_PETSC FALSE) endif() # Find lapack/blas. Skip it if on CRAY! if(CRAY) set(SPCLIBS_USE_PARDISO OFF) endif() include(blas) if(NOT SPCLIBS_EXPORT_TARGETS) set(SPCLIBS_EXPORT_TARGETS spclibs-targets) endif() find_package(MPI COMPONENTS Fortran REQUIRED) include(GNUInstallDirs) set(FFT_EXAMPLES ${SPCLIBS_EXAMPLES}) add_subdirectory(pppack) add_subdirectory(pputils2) + add_subdirectory(fft) + add_subdirectory(solver_interfaces) -add_subdirectory(bsplines) + +if(SPCLIBS_USE_MUMPS) + add_subdirectory(bsplines) +endif() if(HAS_MUMPS AND SPCLIBS_EXAMPLES) add_subdirectory(multigrid) endif() if(SPCLIBS_EXAMPLES) add_subdirectory(examples) add_subdirectory(wk) endif() -export(TARGETS pppack pputils2 fft solver_interfaces bsplines +export(TARGETS pppack pputils2 fft solver_interfaces FILE "${CMAKE_BINARY_DIR}/spclibsLibraryDepends.cmake") +if(SPCLIBS_USE_MUMPS) + export(TARGETS bsplines + FILE "${CMAKE_BINARY_DIR}/spclibsLibraryDepends.cmake") +endif() + if(SPCLIBS_EXPORT_TARGETS MATCHES "spclibs-targets") export(PACKAGE spclibs) # install configuration files install(EXPORT spclibs-targets DESTINATION lib/cmake ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/spclibs-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/spclibs-config.cmake @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/spclibs-config.cmake DESTINATION lib/cmake ) endif() # enable packaging with CPack include(CPack)