USER-QUIP.cmake: create and use imported target

This commit is contained in:
Christoph Junghans
2020-03-24 12:23:39 -06:00
parent d19f112c75
commit f5279a291e
2 changed files with 12 additions and 3 deletions

View File

@ -7,12 +7,21 @@
find_library(QUIP_LIBRARY NAMES quip)
set(QUIP_LIBRARIES ${QUIP_LIBRARY})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set QUIP_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(QUIP DEFAULT_MSG QUIP_LIBRARY)
# Copy the results to the output variables and target.
if(QUIP_FOUND)
set(QUIP_LIBRARIES ${QUIP_LIBRARY})
if(NOT TARGET QUIP::QUIP)
add_library(QUIP::QUIP UNKNOWN IMPORTED)
set_target_properties(QUIP::QUIP PROPERTIES
IMPORTED_LOCATION "${QUIP_LIBRARY}")
endif()
endif()
mark_as_advanced(QUIP_LIBRARY)

View File

@ -1,5 +1,5 @@
if(PKG_USER-QUIP)
enable_language(Fortran)
find_package(QUIP REQUIRED)
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
target_link_libraries(lammps PRIVATE QUIP::QUIP ${LAPACK_LIBRARIES})
endif()