set default to automatically download scafacos lib if not found

This commit is contained in:
Axel Kohlmeyer 2019-04-07 06:10:39 -04:00
parent e57c4c60bd
commit 8c4a497af4
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 11 additions and 3 deletions

View File

@ -520,7 +520,15 @@ endif()
if(PKG_USER-SCAFACOS)
find_package(GSL REQUIRED)
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" OFF)
find_package(PkgConfig QUIET)
set(DOWNLOAD_SCAFACOS_DEFAULT ON)
if(PKG_CONFIG_FOUND)
pkg_check_modules(SCAFACOS QUIET scafacos)
if(SCAFACOS_FOUND)
set(DOWNLOAD_SCAFACOS_DEFAULT OFF)
endif()
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")
include(ExternalProject)
@ -560,8 +568,8 @@ if(PKG_USER-SCAFACOS)
list(APPEND LAMMPS_LINK_LIBS ${MPI_Fortran_LIBRARIES})
list(APPEND LAMMPS_LINK_LIBS ${MPI_C_LIBRARIES})
else()
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(SCAFACOS scafacos REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SCAFACOS REQUIRED scafacos)
list(APPEND LAMMPS_LINK_LIBS ${SCAFACOS_LDFLAGS})
endif()
include_directories(${SCAFACOS_INCLUDE_DIRS})