cmake : use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR (#28771)

This commit updates cmake to use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR for paths in function calls.

The motivation for this is that when using add_subdirectory,
CMAKE_SOURCE_DIR is fixed to the top-level projects source directory,
that is the caller of add_subdirectory and not the llama.cpp root
which means that common/common.h header will not be resolved.

Refs: https://github.com/ggml-org/llama.cpp/pull/28091#issuecomment-5636106377
This commit is contained in:
Daniel Bevenius
2026-09-15 05:26:09 +02:00
committed by GitHub
parent 1bc7a5af0d
commit 69eb250670
11 changed files with 54 additions and 20 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ if(LLAMA_BUILD_TESTS)
-DDEST=${MODEL_DEST}
-DNAME=${MODEL_NAME}
-DHASH=${MODEL_HASH}
-P ${CMAKE_SOURCE_DIR}/cmake/download-models.cmake
-P ${PROJECT_SOURCE_DIR}/cmake/download-models.cmake
)
set_tests_properties(${TEST_TARGET}-download-model PROPERTIES FIXTURES_SETUP ${TEST_TARGET}-download-model)
add_test(NAME ${TEST_TARGET} COMMAND llama-eval-callback -m "${MODEL_DEST}" --prompt hello --seed 42 -ngl 0)