project(bsplines_src) set(SRCS bsplines.f90 matrix.f90 sparse_mod.f90 lapack_extra.f math_util.f90 conmat.f90 ) set(PUBLIC_MODULES bsplines.mod matrix.mod math_util.mod conmat_mod.mod sparse.mod ) if(HAS_PARDISO) list(APPEND ${SRCS_PP} pardiso_mod.f90) endif() set_property(SOURCE conmat.f90 APPEND PROPERTY COMPILE_OPTIONS -DWSMP ${MKL_DEFINITIONS}) if(HAS_MUMPS) list(APPEND SRCS multigrid_mod.f90 mumps_mod.f90 csr_mod.f90 cds_mod.f90 ) list(APPEND PUBLIC_MODULES cds.mod csr.mod mumps_bsplines.mod) set_property(SOURCE conmat.f90 APPEND PROPERTY COMPILE_OPTIONS -DMUMPS) endif() set(_public_headers) foreach(_modules ${PUBLIC_MODULES}) list(APPEND _public_headers ${CMAKE_CURRENT_BINARY_DIR}/${_modules}) endforeach() include(GNUInstallDirs) add_library(bsplines ${SRCS}) target_include_directories(bsplines PRIVATE $ ${MUMPS_INCLUDE_DIR} ${PETSC_INCLUDE_DIRS} INTERFACE $ $ ) set_property(TARGET bsplines PROPERTY PUBLIC_HEADER ${_public_headers}) target_link_libraries(bsplines PUBLIC futils pppack pputils2 fft ${BLAS_LIBRARIES} ${MUMPS_LIBRARIES} ${LAPACK_LIBRARIES} ${PETSC_LIBRARIES} ) target_compile_options(bsplines PRIVATE -cpp) if(MKL_Fortran_FLAGS) separate_arguments(MKL_Fortran_FLAGS) target_compile_options(bsplines PUBLIC ${MKL_Fortran_FLAGS}) target_link_options(bsplines PUBLIC ${MKL_Fortran_FLAGS}) endif() install(TARGETS bsplines EXPORT ${BSPLINES_EXPORT_TARGETS} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )