summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrijdavid <david@geek.mg>2023-12-29 15:18:20 +0100
committerGitHub <noreply@github.com>2023-12-29 16:18:20 +0200
commit82d6eab224862a7044069fb9211dc4b29124264b (patch)
treeea57678fba758c641f37b6fe3f80166d47bd163f
parentafd997ab6011dfefe9e917425b04ef4d83614841 (diff)
main-cmake-pkg : fix build issue (#4665)
* Fix main-cmake-pkg compilation * Use glob to load common files * cmake : fix trailing whitespace --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
-rw-r--r--examples/main-cmake-pkg/CMakeLists.txt27
1 files changed, 6 insertions, 21 deletions
diff --git a/examples/main-cmake-pkg/CMakeLists.txt b/examples/main-cmake-pkg/CMakeLists.txt
index cb00edbb..deb77d58 100644
--- a/examples/main-cmake-pkg/CMakeLists.txt
+++ b/examples/main-cmake-pkg/CMakeLists.txt
@@ -7,28 +7,13 @@ find_package(Llama 0.0.1 REQUIRED)
# Bake common functionality in with target. Because applications
# using the relocatable Llama package should be outside of the
# source tree, main-cmake-pkg pretends the dependencies are built-in.
-
set(_common_path "${CMAKE_CURRENT_LIST_DIR}/../../common")
-add_library(common OBJECT
- ${_common_path}/common.h
- ${_common_path}/common.cpp
- ${_common_path}/console.h
- ${_common_path}/console.cpp
- ${_common_path}/grammar-parser.h
- ${_common_path}/grammar-parser.cpp
- ${_common_path}/sampling.h
- ${_common_path}/sampling.cpp
- )
-
-# WARNING: because build-info.h is auto-generated, it will only
-# be available after the user has built the llama.cpp sources.
-#
-configure_file(${_common_path}/../build-info.h
- ${CMAKE_CURRENT_BINARY_DIR}/build-info.h
- COPYONLY)
-
-target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR})
+add_library(common OBJECT)
+file(GLOB _common_files
+ "${_common_path}/*.h"
+ "${_common_path}/*.cpp"
+)
+target_sources(common PRIVATE ${_common_files})
# If the common project was part of "main-cmake-pkg" the transient
# defines would automatically be attached. Because the common func-