Skip to content

Commit 82d6eab

Browse files
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>
1 parent afd997a commit 82d6eab

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

examples/main-cmake-pkg/CMakeLists.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,13 @@ find_package(Llama 0.0.1 REQUIRED)
77
# Bake common functionality in with target. Because applications
88
# using the relocatable Llama package should be outside of the
99
# source tree, main-cmake-pkg pretends the dependencies are built-in.
10-
1110
set(_common_path "${CMAKE_CURRENT_LIST_DIR}/../../common")
12-
add_library(common OBJECT
13-
${_common_path}/common.h
14-
${_common_path}/common.cpp
15-
${_common_path}/console.h
16-
${_common_path}/console.cpp
17-
${_common_path}/grammar-parser.h
18-
${_common_path}/grammar-parser.cpp
19-
${_common_path}/sampling.h
20-
${_common_path}/sampling.cpp
21-
)
22-
23-
# WARNING: because build-info.h is auto-generated, it will only
24-
# be available after the user has built the llama.cpp sources.
25-
#
26-
configure_file(${_common_path}/../build-info.h
27-
${CMAKE_CURRENT_BINARY_DIR}/build-info.h
28-
COPYONLY)
29-
30-
target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
31-
${CMAKE_CURRENT_BINARY_DIR})
11+
add_library(common OBJECT)
12+
file(GLOB _common_files
13+
"${_common_path}/*.h"
14+
"${_common_path}/*.cpp"
15+
)
16+
target_sources(common PRIVATE ${_common_files})
3217

3318
# If the common project was part of "main-cmake-pkg" the transient
3419
# defines would automatically be attached. Because the common func-

0 commit comments

Comments
 (0)