workaround for GNU Fortran 10 and later when compiling downloaded ScaFaCoS lib

This commit is contained in:
Axel Kohlmeyer 2020-06-15 10:59:32 -04:00
parent 12b379df36
commit b5ee87697a
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 26 additions and 3 deletions

View File

@ -14,6 +14,29 @@ endif()
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" ${DOWNLOAD_SCAFACOS_DEFAULT})
if(DOWNLOAD_SCAFACOS)
message(STATUS "ScaFaCoS download requested - we will build our own")
# create variables to pass our compiler flags along to the subsystem compile
# need to apply -fallow-argument-mismatch, if the fortran compiler supports it
include(CheckFortranCompilerFlag)
check_fortran_compiler_flag("-fallow-argument-mismatch" GNUFortran_ARGUMENT_MISMATCH_FLAG)
if(GNUFortran_ARGUMENT_MISMATCH_FLAG)
set(APPEND_Fortran_FLAG "-fallow-argument-mismatch")
endif()
if(CMAKE_Fortran_FLAGS)
set(SCAFACOS_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${APPEND_Fortran_FLAG}")
else()
set(SCAFACOS_Fortran_FLAGS "${CMAKE_Fortran_${CMAKE_BUILD_TYPE}_FLAGS} ${APPEND_Fortran_FLAG}")
endif()
if(CMAKE_CXX_FLAGS)
set(SCAFACOS_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(SCAFACOS_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS}")
endif()
if(CMAKE_C_FLAGS)
set(SCAFACOS_C_FLAGS "${CMAKE_C_FLAGS}")
else()
set(SCAFACOS_C_FLAGS "${CMAKE_C_${CMAKE_BUILD_TYPE}_FLAGS}")
endif()
include(ExternalProject)
ExternalProject_Add(scafacos_build
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz
@ -22,9 +45,9 @@ if(DOWNLOAD_SCAFACOS)
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
--with-internal-fftw --with-internal-pfft
--with-internal-pnfft ${CONFIGURE_REQUEST_PIC}
FC=${CMAKE_MPI_Fortran_COMPILER}
CXX=${CMAKE_MPI_CXX_COMPILER}
CC=${CMAKE_MPI_C_COMPILER}
FC=${CMAKE_MPI_Fortran_COMPILER} FCFLAGS=${SCAFACOS_Fortran_FLAGS}
CXX=${CMAKE_MPI_CXX_COMPILER} CXXFLAGS=${SCAFACOS_CXX_FLAGS}
CC=${CMAKE_MPI_C_COMPILER} CFLAGS=${SCAFACOS_C_FLAGS}
F77=
BUILD_BYPRODUCTS
<INSTALL_DIR>/lib/libfcs.a