Skip to content

minimal fetchcontent

Lori A. Burns requested to merge loriab/libxc:basic_fetchcontent into master

fwiw, I think these are the minimal changes (not full set of best practices) to make Libxc conveniently useable through FetchContent. It adds the aliases so consuming projects can use the "public" targets evenly btwn find_package and fetchcontent. It also adds a package variable to the target so that quantity is accessible.

This, plus more, is available through !604, but I've removed the overlapping part from !605. I don't personally need any of this, so just giving you options.

cmake_minimum_required(VERSION 3.11)

project(MyProj C)

include(FetchContent)
FetchContent_Declare(
  mylibxc
  URL      /psi/gits/libxc_clean/
)
FetchContent_MakeAvailable(mylibxc)

get_target_property(_xc_ver Libxc::xc LIBXC_VERSION)
message("Libxc version ${_xc_ver}")

add_executable(mybasic basic.c)
target_link_libraries(mybasic Libxc::xc)

Merge request reports