forked from lijiext/lammps
Merge pull request #2030 from lammps/revert-2018-cmake_kim-api_find
Revert "cmake: move kim-api detection to cmake config"
This commit is contained in:
commit
0f28e0eb0f
|
@ -20,8 +20,8 @@ if(NOT @BUILD_SHARED_LIBS@)
|
|||
find_dependency(ZLIB REQUIRED)
|
||||
endif()
|
||||
if(@PKG_KIM@)
|
||||
find_package(KIM-API @KIM-API_MIN_VERSION@ CONFIG REQUIRED)
|
||||
add_kim_api_imported_library()
|
||||
find_dependency(PkgConfig REQUIRED)
|
||||
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=@KIM-API_MIN_VERSION@)
|
||||
if(@CURL_FOUND@)
|
||||
find_dependency(CURL REQUIRED)
|
||||
endif()
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
# CMake configuration for KIM package
|
||||
set(KIM-API_MIN_VERSION 2.1.3)
|
||||
find_package(CURL)
|
||||
if(CURL_FOUND)
|
||||
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS})
|
||||
target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||
mark_as_advanced(LMP_DEBUG_CURL)
|
||||
|
@ -15,11 +19,13 @@ if(CURL_FOUND)
|
|||
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
||||
endif()
|
||||
endif()
|
||||
find_package(KIM-API ${KIM-API_MIN_VERSION} CONFIG)
|
||||
if(KIM-API_FOUND)
|
||||
set(DOWNLOAD_KIM_DEFAULT OFF)
|
||||
else()
|
||||
set(DOWNLOAD_KIM_DEFAULT ON)
|
||||
find_package(PkgConfig QUIET)
|
||||
set(DOWNLOAD_KIM_DEFAULT ON)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(KIM-API QUIET libkim-api>=${KIM-API_MIN_VERSION})
|
||||
if(KIM-API_FOUND)
|
||||
set(DOWNLOAD_KIM_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
option(DOWNLOAD_KIM "Download KIM-API from OpenKIM instead of using an already installed one" ${DOWNLOAD_KIM_DEFAULT})
|
||||
if(DOWNLOAD_KIM)
|
||||
|
@ -54,7 +60,7 @@ if(DOWNLOAD_KIM)
|
|||
install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")")
|
||||
endif()
|
||||
else()
|
||||
find_package(KIM-API ${KIM-API_MIN_VERSION} CONFIG REQUIRED)
|
||||
add_kim_api_imported_library()
|
||||
target_link_libraries(lammps PRIVATE kim-api)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION})
|
||||
target_link_libraries(lammps PRIVATE PkgConfig::KIM-API)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue