Skip to content

Commit

Permalink
CMake config: let tblite be found from modified fork (if git submodul…
Browse files Browse the repository at this point in the history
…e was not initialized)
  • Loading branch information
pprcht committed Aug 25, 2024
1 parent 3f6404b commit bbf8803
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions config/modules/Findtblite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

set(_lib "tblite")
set(_pkg "TBLITE")
set(_url "https://github.com/tblite/tblite")
#set(_url "https://github.com/tblite/tblite")
set(_url "https://github.com/pprcht/tblite")
set(_branch "xtb_solvation")

if(NOT DEFINED "${_pkg}_FIND_METHOD")
set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf")
Expand All @@ -27,7 +29,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake")
set(temp_with_tests ${WITH_TESTS}) # Save the current value of WITH_TESTS
set(WITH_TESTS FALSE CACHE BOOL "Temporarily disable tests for the tblite subproject" FORCE)
set(WITH_API FALSE)
crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}")
crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}" "${_branch}")

set(found FALSE)
if(TARGET "tblite::tblite")
Expand Down
10 changes: 8 additions & 2 deletions config/modules/crest-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ macro(
methods
url
)

if(NOT DEFINED ARGV3)
set(branch "HEAD") # Default to HEAD if branch is not provided
else()
set(branch "${ARGV3}") # Use the provided branch
endif()

string(TOLOWER "${package}" _pkg_lc)
string(TOUPPER "${package}" _pkg_uc)


# iterate through lookup types in order
foreach(method ${methods})

Expand Down Expand Up @@ -112,7 +118,7 @@ macro(
FetchContent_Declare(
"${_pkg_lc}"
GIT_REPOSITORY "${url}"
GIT_TAG "HEAD"
GIT_TAG "${branch}"
)
FetchContent_MakeAvailable("${_pkg_lc}")

Expand Down

0 comments on commit bbf8803

Please sign in to comment.