cmake: add DOWNLOAD_KIM option

This commit is contained in:
Christoph Junghans
2018-05-12 09:48:15 -06:00
parent 6b73e29f64
commit 55d8cc0341

View File

@ -370,9 +370,8 @@ if(PKG_USER-VTK)
endif()
if(PKG_KIM)
find_package(KIM QUIET)
if(NOT KIM_FOUND)
message(STATUS "KIM not found - we will build our own")
option(DOWNLOAD_KIM "Download kim-api (instead of using the system's one)" OFF)
if(DOWNLOAD_KIM)
include(ExternalProject)
ExternalProject_Add(kim_build
URL https://github.com/openkim/kim-api/archive/v1.9.5.tar.gz
@ -384,6 +383,11 @@ if(PKG_KIM)
set(KIM_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api-v1)
set(KIM_LIBRARIES ${INSTALL_DIR}/lib/libkim-api-v1.so)
list(APPEND LAMMPS_DEPS kim_build)
else()
find_package(KIM)
if(NOT KIM_FOUND)
message(FATAL_ERROR "KIM not found, help CMake to find it by setting KIM_LIBRARY and KIM_INCLUDE_DIR, or set DOWNLOAD_KIM=ON to download it")
endif()
endif()
list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES})
include_directories(${KIM_INCLUDE_DIRS})