mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
Improve CP2K CMake package metadata exports (#5400)
This commit is contained in:
parent
c28f603b59
commit
9ca34697db
1 changed files with 67 additions and 77 deletions
|
|
@ -14,10 +14,11 @@ if(NOT TARGET cp2k::cp2k)
|
|||
|
||||
# Store CXX compiler id used in MKL package
|
||||
set(CP2K_CXX_COMPILER_ID @CMAKE_CXX_COMPILER_ID@)
|
||||
if(NOT ${CMAKE_CXX_COMPILER_ID})
|
||||
if(NOT CMAKE_CXX_COMPILER_ID)
|
||||
set(CMAKE_CXX_COMPILER_ID ${CP2K_CXX_COMPILER_ID})
|
||||
endif()
|
||||
|
||||
# Define LAPACK and BLAS TARGETS
|
||||
set(CP2K_BLAS_VENDOR @CP2K_BLAS_VENDOR@)
|
||||
set(CP2K_SCALAPACK_VENDOR @CP2K_SCALAPACK_VENDOR@)
|
||||
set(CP2K_BLAS_LINK_LIBRARIES @CP2K_BLAS_LINK_LIBRARIES@)
|
||||
|
|
@ -26,10 +27,9 @@ if(NOT TARGET cp2k::cp2k)
|
|||
set(CP2K_CONFIG_PACKAGE ON)
|
||||
find_dependency(Lapack REQUIRED)
|
||||
|
||||
# Define LAPACK and BLAS TARGETS
|
||||
|
||||
if(@CP2K_USE_MPI@)
|
||||
set(CP2K_USE_MPI @CP2K_USE_MPI@)
|
||||
set(CP2K_USE_MPI @CP2K_USE_MPI@)
|
||||
if(CP2K_USE_MPI)
|
||||
find_dependency(MPI REQUIRED)
|
||||
find_dependency(SCALAPACK REQUIRED)
|
||||
endif()
|
||||
unset(CP2K_CONFIG_PACKAGE)
|
||||
|
|
@ -38,55 +38,54 @@ if(NOT TARGET cp2k::cp2k)
|
|||
|
||||
find_dependency(DBCSR 2.8 REQUIRED)
|
||||
|
||||
if (@CP2K_USE_LIBXSMM@)
|
||||
set(CP2K_USE_LIBXSMM @CP2K_USE_LIBXSMM@)
|
||||
find_dependency(libxsmm REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBXS@)
|
||||
set(CP2K_USE_LIBXS @CP2K_USE_LIBXS@)
|
||||
set(CP2K_USE_LIBXS @CP2K_USE_LIBXS@)
|
||||
set(CP2K_USE_LIBXSMM @CP2K_USE_LIBXSMM@)
|
||||
if(CP2K_USE_LIBXS)
|
||||
find_dependency(libxs REQUIRED)
|
||||
if(CP2K_USE_LIBXSMM)
|
||||
find_dependency(libxsmm REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_OPENCL@)
|
||||
set(CP2K_USE_OPENCL @CP2K_USE_OPENCL@)
|
||||
set(CP2K_USE_OPENCL @CP2K_USE_OPENCL@)
|
||||
if(CP2K_USE_OPENCL)
|
||||
find_dependency(OpenCL REQUIRED)
|
||||
find_dependency(libxstream REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_HIP@)
|
||||
set(CP2K_USE_HIP @CP2K_USE_HIP@)
|
||||
set(CP2K_USE_HIP @CP2K_USE_HIP@)
|
||||
if(CP2K_USE_HIP)
|
||||
# Find HIP
|
||||
find_dependency(hipfft REQUIRED IMPORTED CONFIG)
|
||||
find_dependency(hipblas REQUIRED IMPORTED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_CUDA@)
|
||||
set(CP2K_USE_CUDA @CP2K_USE_CUDA@)
|
||||
set(CP2K_USE_CUDA @CP2K_USE_CUDA@)
|
||||
if(CP2K_USE_CUDA)
|
||||
find_dependency(CUDAToolkit REQUIRED)
|
||||
endif()
|
||||
if(@CP2K_USE_ELPA@)
|
||||
set(CP2K_USE_ELPA @CP2K_USE_ELPA@)
|
||||
set(CP2K_USE_ELPA @CP2K_USE_ELPA@)
|
||||
if(CP2K_USE_ELPA)
|
||||
find_dependency(Elpa REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_DLAF@)
|
||||
set(CP2K_USE_DLAF @CP2K_USE_DLAF@)
|
||||
set(CP2K_USE_DLAF @CP2K_USE_DLAF@)
|
||||
if(CP2K_USE_DLAF)
|
||||
find_dependency(DLAFFortran 0.4.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBXC@)
|
||||
set(CP2K_USE_LIBXC @CP2K_USE_LIBXC@)
|
||||
set(CP2K_USE_LIBXC @CP2K_USE_LIBXC@)
|
||||
if(CP2K_USE_LIBXC)
|
||||
find_dependency(Libxc 7 REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_GAUXC@)
|
||||
set(CP2K_USE_GAUXC @CP2K_USE_GAUXC@)
|
||||
set(CP2K_USE_GAUXC @CP2K_USE_GAUXC@)
|
||||
if(CP2K_USE_GAUXC)
|
||||
find_dependency(gauxc REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_COSMA@)
|
||||
set(CP2K_USE_COSMA @CP2K_USE_COSMA@)
|
||||
set(CP2K_USE_COSMA @CP2K_USE_COSMA@)
|
||||
if(CP2K_USE_COSMA)
|
||||
find_dependency(cosma REQUIRED)
|
||||
if(NOT TARGET cp2k::cosma)
|
||||
add_library(cp2k::cosma INTERFACE IMPORTED)
|
||||
|
|
@ -95,98 +94,93 @@ if(NOT TARGET cp2k::cp2k)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_MPI@)
|
||||
set(CP2K_USE_MPI @CP2K_USE_MPI@)
|
||||
find_dependency(MPI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_FFTW3@)
|
||||
set(CP2K_USE_FFTW3 @CP2K_USE_FFTW3@)
|
||||
set(CP2K_USE_FFTW3 @CP2K_USE_FFTW3@)
|
||||
if(CP2K_USE_FFTW3)
|
||||
find_dependency(Fftw REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBINT2@)
|
||||
set(CP2K_USE_LIBINT2 @CP2K_USE_LIBINT2@)
|
||||
set(CP2K_USE_LIBINT2 @CP2K_USE_LIBINT2@)
|
||||
if(CP2K_USE_LIBINT2)
|
||||
find_dependency(Libint2 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBFCI@)
|
||||
set(CP2K_USE_LIBFCI @CP2K_USE_LIBFCI@)
|
||||
set(CP2K_USE_LIBFCI @CP2K_USE_LIBFCI@)
|
||||
if(CP2K_USE_LIBFCI)
|
||||
find_dependency(LibFCI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SPGLIB@)
|
||||
set(CP2K_USE_SPGLIB @CP2K_USE_SPGLIB@)
|
||||
set(CP2K_USE_SPGLIB @CP2K_USE_SPGLIB@)
|
||||
if(CP2K_USE_SPGLIB)
|
||||
find_dependency(Spglib REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SPLA@)
|
||||
set(CP2K_USE_SPLA @CP2K_USE_SPLA@)
|
||||
set(CP2K_USE_SPLA @CP2K_USE_SPLA@)
|
||||
if(CP2K_USE_SPLA)
|
||||
find_dependency(SPLA REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_SIRIUS@)
|
||||
set(CP2K_USE_SIRIUS @CP2K_USE_SIRIUS@)
|
||||
set(CP2K_USE_SIRIUS @CP2K_USE_SIRIUS@)
|
||||
if(CP2K_USE_SIRIUS)
|
||||
find_dependency(sirius 7.7.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PLUMED@)
|
||||
set(CP2K_USE_PLUMED @CP2K_USE_PLUMED@)
|
||||
set(CP2K_USE_PLUMED @CP2K_USE_PLUMED@)
|
||||
if(CP2K_USE_PLUMED)
|
||||
find_dependency(Plumed REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBTORCH@)
|
||||
set(CP2K_USE_LIBTORCH @CP2K_USE_LIBTORCH@)
|
||||
set(CP2K_USE_LIBTORCH @CP2K_USE_LIBTORCH@)
|
||||
if(CP2K_USE_LIBTORCH)
|
||||
find_dependency(Torch REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_HDF5@)
|
||||
set(CP2K_USE_HDF5 @CP2K_USE_HDF5@)
|
||||
set(CP2K_USE_HDF5 @CP2K_USE_HDF5@)
|
||||
if(CP2K_USE_HDF5)
|
||||
find_dependency(HDF5 REQUIRED COMPONENTS C Fortran)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_DFTD4@)
|
||||
set(CP2K_USE_DFTD4 @CP2K_USE_DFTD4@)
|
||||
set(CP2K_USE_DFTD4 @CP2K_USE_DFTD4@)
|
||||
if(CP2K_USE_DFTD4)
|
||||
find_dependency(dftd4 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_DEEPMD@)
|
||||
set(CP2K_USE_DEEPMD @CP2K_USE_DEEPMD@)
|
||||
set(CP2K_USE_DEEPMD @CP2K_USE_DEEPMD@)
|
||||
if(CP2K_USE_DEEPMD)
|
||||
find_dependency(DeePMD REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_PEXSI@)
|
||||
set(CP2K_USE_PEXSI @CP2K_USE_PEXSI@)
|
||||
set(CP2K_USE_PEXSI @CP2K_USE_PEXSI@)
|
||||
if(CP2K_USE_PEXSI)
|
||||
find_dependency(PEXSI REQUIRED CONFIG)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_ACE@)
|
||||
set(CP2K_USE_ACE @CP2K_USE_ACE@)
|
||||
set(CP2K_USE_ACE @CP2K_USE_ACE@)
|
||||
if(CP2K_USE_ACE)
|
||||
find_dependency(pace REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_LIBSMEAGOL@)
|
||||
set(CP2K_USE_LIBSMEAGOL @CP2K_USE_LIBSMEAGOL@)
|
||||
set(CP2K_USE_LIBSMEAGOL @CP2K_USE_LIBSMEAGOL@)
|
||||
if(CP2K_USE_LIBSMEAGOL)
|
||||
find_dependency(libsmeagol REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_MIMIC@)
|
||||
set(CP2K_USE_MIMIC @CP2K_USE_MIMIC@)
|
||||
set(CP2K_USE_MIMIC @CP2K_USE_MIMIC@)
|
||||
if(CP2K_USE_MIMIC)
|
||||
find_dependency(MiMiC REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_OPENPMD@)
|
||||
set(CP2K_USE_OPENPMD @CP2K_USE_OPENPMD@)
|
||||
set(CP2K_USE_OPENPMD @CP2K_USE_OPENPMD@)
|
||||
if(CP2K_USE_OPENPMD)
|
||||
find_dependency(openPMD 0.16.1 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_VORI@)
|
||||
set(CP2K_USE_VORI @CP2K_USE_VORI@)
|
||||
set(CP2K_USE_VORI @CP2K_USE_VORI@)
|
||||
if(CP2K_USE_VORI)
|
||||
find_dependency(LibVORI REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_GREENX@)
|
||||
set(CP2K_USE_GREENX @CP2K_USE_GREENX@)
|
||||
set(CP2K_USE_GREENX @CP2K_USE_GREENX@)
|
||||
if(CP2K_USE_GREENX)
|
||||
find_dependency(greenX REQUIRED CONFIG)
|
||||
if(NOT TARGET cp2k::greenx)
|
||||
add_library(cp2k::greenx INTERFACE IMPORTED)
|
||||
|
|
@ -196,12 +190,8 @@ if(NOT TARGET cp2k::cp2k)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_TBLITE@)
|
||||
set(CP2K_USE_TBLITE @CP2K_USE_TBLITE@)
|
||||
find_dependency(mctc-lib REQUIRED)
|
||||
find_dependency(toml-f REQUIRED)
|
||||
find_dependency(dftd4 REQUIRED)
|
||||
find_dependency(s-dftd3 REQUIRED)
|
||||
set(CP2K_USE_TBLITE @CP2K_USE_TBLITE@)
|
||||
if(CP2K_USE_TBLITE)
|
||||
find_dependency(tblite REQUIRED)
|
||||
if(NOT TARGET cp2k::tblite)
|
||||
add_library(cp2k::tblite INTERFACE IMPORTED)
|
||||
|
|
@ -211,8 +201,8 @@ if(NOT TARGET cp2k::cp2k)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(@CP2K_USE_TREXIO@)
|
||||
set(CP2K_USE_TREXIO @CP2K_USE_TREXIO@)
|
||||
set(CP2K_USE_TREXIO @CP2K_USE_TREXIO@)
|
||||
if(CP2K_USE_TREXIO)
|
||||
find_dependency(TrexIO REQUIRED)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue