evaleev / libint

Libint: high-performance library for computing Gaussian integrals in quantum mechanics
Other
229 stars 95 forks source link

Alias CMake Targets for In-Source Builds #207

Closed wavefunction91 closed 3 years ago

wavefunction91 commented 3 years ago

Make it so find/build targets are the same in exported CMake build. Previously, the build targets were named e.g. int2 and cxx whereas the installed targets were namespaced Libint2::. This PR allow for the following

cmake_minimum_required( VERSION 3.17 FATAL_ERROR )
project( libint2-as-subproject LANGUAGES CXX )

find_package( Libint2 )
if( NOT Libint2_FOUND )
  include( FetchContent )
  FetchContent_Declare( libint2
    URL https://.......
  )
  FetchContent_MakeAvailable( libint2 )
endif()

add_executable( my_exe test.cxx )
target_link_libraries( my_exe PUBLIC Libint2::int2 )