LAMMPSConfig.cmake.in: improve static lib case

This commit is contained in:
Christoph Junghans 2020-04-05 19:52:28 -06:00
parent d8402b6249
commit f0817321f9
2 changed files with 18 additions and 9 deletions

View File

@ -2,11 +2,20 @@ include(CMakeFindDependencyMacro)
if(@BUILD_MPI@)
find_dependency(MPI REQUIRED CXX)
endif()
if(@WITH_JPEG@)
find_dependency(JPEG REQUIRED)
endif()
if(@WITH_PNG@)
find_dependency(PNG REQUIRED)
find_dependency(ZLIB REQUIRED)
if(NOT @BUILD_SHARED_LIBS@)
if(@WITH_JPEG@)
find_dependency(JPEG REQUIRED)
endif()
if(@WITH_PNG@)
find_dependency(PNG REQUIRED)
find_dependency(ZLIB REQUIRED)
endif()
if(@PKG_KIM@ AND NOT @DOWNLOAD_KIM@)
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()
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/LAMMPS_Targets.cmake")

View File

@ -1,4 +1,4 @@
set(KIM-API_MIN_VERSION 2.1)
set(KIM-API_MIN_VERSION 2.1.3)
find_package(CURL)
if(CURL_FOUND)
target_link_libraries(lammps PRIVATE CURL::libcurl)
@ -17,7 +17,7 @@ endif()
find_package(PkgConfig QUIET)
set(DOWNLOAD_KIM_DEFAULT ON)
if(PKG_CONFIG_FOUND)
pkg_check_modules(KIM-API QUIET libkim-api>=2.1.3)
pkg_check_modules(KIM-API QUIET libkim-api>=${KIM-API_MIN_VERSION})
if(KIM-API_FOUND)
set(DOWNLOAD_KIM_DEFAULT OFF)
endif()
@ -53,6 +53,6 @@ if(DOWNLOAD_KIM)
add_dependencies(LAMMPS::KIM kim_build)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=2.1.3)
pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION})
target_link_libraries(lammps PRIVATE PkgConfig::KIM-API)
endif()