Skip to content

Commit 1e8924f

Browse files
authored
cmake : add variable to skip installing tests (ggml-org#19370)
When packaging downstream, there's usually little point in installing test. The default behaviour remains the same.
1 parent 39bf692 commit 1e8924f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ option(LLAMA_BUILD_TOOLS "llama: build tools" ${LLAMA_STANDALONE})
109109
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
110110
option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE})
111111
option(LLAMA_TOOLS_INSTALL "llama: install tools" ${LLAMA_TOOLS_INSTALL_DEFAULT})
112+
option(LLAMA_TESTS_INSTALL "llama: install tests" ON)
112113

113114
# 3rd party libs
114115
option(LLAMA_HTTPLIB "llama: httplib for downloading functionality" ON)

tests/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ function(llama_build source)
1111

1212
add_executable(${TEST_TARGET} ${TEST_SOURCES})
1313
target_link_libraries(${TEST_TARGET} PRIVATE common)
14-
install(TARGETS ${TEST_TARGET} RUNTIME)
14+
if (LLAMA_TESTS_INSTALL)
15+
install(TARGETS ${TEST_TARGET} RUNTIME)
16+
endif()
1517
endfunction()
1618

1719
function(llama_test target)
@@ -100,7 +102,9 @@ function(llama_build_and_test source)
100102
endif()
101103

102104
add_executable(${TEST_TARGET} ${TEST_SOURCES})
103-
install(TARGETS ${TEST_TARGET} RUNTIME)
105+
if (LLAMA_TESTS_INSTALL)
106+
install(TARGETS ${TEST_TARGET} RUNTIME)
107+
endif()
104108
target_link_libraries(${TEST_TARGET} PRIVATE common)
105109

106110
add_test(

0 commit comments

Comments
 (0)