USER-QUIP.cmake: create and use imported target
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user