USER-SCAFACOS.cmake: use imported pkg-config target

This commit is contained in:
Christoph Junghans 2020-03-24 11:49:24 -06:00
parent d8b6d10f3b
commit 72c94f0fbf
1 changed files with 3 additions and 4 deletions

View File

@ -46,7 +46,7 @@ if(PKG_USER-SCAFACOS)
)
ExternalProject_get_property(scafacos_build INSTALL_DIR)
set(SCAFACOS_BUILD_DIR ${INSTALL_DIR})
set(SCAFACOS_INCLUDE_DIRS ${SCAFACOS_BUILD_DIR}/include)
target_include_directories(lammps PRIVATE ${SCAFACOS_BUILD_DIR}/include)
add_dependencies(lammps scafacos_build)
# list and order from pkg_config file of ScaFaCoS build
target_link_libraries(lammps PRIVATE ${SCAFACOS_BUILD_DIR}/lib/libfcs.a)
@ -69,8 +69,7 @@ if(PKG_USER-SCAFACOS)
target_link_libraries(lammps PRIVATE ${MPI_C_LIBRARIES})
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(SCAFACOS REQUIRED scafacos)
target_link_libraries(lammps PRIVATE ${SCAFACOS_LDFLAGS})
pkg_check_modules(SCAFACOS REQUIRED IMPORTED_TARGET scafacos)
target_link_libraries(lammps PRIVATE PkgConfig::SCAFACOS)
endif()
include_directories(${SCAFACOS_INCLUDE_DIRS})
endif()