mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
* More work on cmake * Fix funky libxsmm library order * Fix naming conventions * fix namespace name * Fix libxc include (#6) * Fix cosma * make pretty * Add MPI08 support. Minor cleanups --------- Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
62 lines
2.2 KiB
CMake
62 lines
2.2 KiB
CMake
#!-------------------------------------------------------------------------------------------------!
|
|
#! CP2K: A general program to perform molecular dynamics simulations !
|
|
#! Copyright 2000-2023 CP2K developers group <https://cp2k.org> !
|
|
#! !
|
|
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
|
#!-------------------------------------------------------------------------------------------------!
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package(PkgConfig REQUIRED)
|
|
include(cp2k_utils)
|
|
|
|
cp2k_set_default_paths(LIBXC "LibXC")
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
pkg_check_modules(CP2K_LIBXC IMPORTED_TARGET GLOBAL libxcf90 libxcf03
|
|
libxc>=${LibXC_FIND_VERSION})
|
|
endif()
|
|
|
|
if(NOT CP2K_LIBXC_FOUND)
|
|
# Revert pkg_check_modules side effects
|
|
cp2k_set_default_paths(LIBXC "LibXC")
|
|
foreach(_var xc xcf03 xcf90)
|
|
string(TOUPPER LIB${_var} _var_up)
|
|
cp2k_find_libraries(${_var_up} ${_var})
|
|
endforeach()
|
|
endif()
|
|
|
|
if(CP2K_LIBXC_FOUND
|
|
AND CP2K_LIBXCF90_FOUND
|
|
AND CP2K_LIBXCF03_FOUND)
|
|
set(CP2K_LIBXC_LINK_LIBRARIES
|
|
"${CP2K_LIBXCF03_LIBRARIES};${CP2K_LIBXCF90_LIBRARIES};${CP2K_LIBXC_LIBRARIES}"
|
|
)
|
|
endif()
|
|
|
|
if(NOT CP2K_LIBXC_INCLUDE_DIRS)
|
|
cp2k_include_dirs(LIBXC "xc.h;libxc/xc.h")
|
|
endif()
|
|
|
|
if(CP2K_LIBXC_INCLUDE_DIRS)
|
|
find_package_handle_standard_args(
|
|
LibXC DEFAULT_MSG CP2K_LIBXC_FOUND CP2K_LIBXC_LINK_LIBRARIES
|
|
CP2K_LIBXC_INCLUDE_DIRS)
|
|
else()
|
|
find_package_handle_standard_args(LibXC DEFAULT_MSG CP2K_LIBXC_FOUND
|
|
CP2K_LIBXC_LINK_LIBRARIES)
|
|
endif()
|
|
if(CP2K_LIBXC_FOUND)
|
|
if(NOT TARGET CP2K::Libxc::xc)
|
|
add_library(CP2K::Libxc::xc INTERFACE IMPORTED)
|
|
endif()
|
|
|
|
if(CP2K_LIBXC_INCLUDE_DIRS)
|
|
set_target_properties(
|
|
CP2K::Libxc::xc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
|
"${CP2K_LIBXC_INCLUDE_DIRS}")
|
|
endif()
|
|
target_link_libraries(CP2K::Libxc::xc INTERFACE ${CP2K_LIBXC_LINK_LIBRARIES})
|
|
endif()
|
|
|
|
mark_as_advanced(CP2K_LIBXC_FOUND CP2K_LIBXC_LINK_LIBRARIES
|
|
CP2K_LIBXC_INCLUDE_DIRS)
|