Skip to content

Commit 458952e

Browse files
committed
ggml-cpu : prevent kleidiai build/install targets
* currently cmake install targets of kleidiai generate error * set EXCLUDE_FROM_ALL in `FetchContent_MakeAvailable` for cmake 3.28+ * use `FetchContent_Populate` for cmake version less than 3.28 * note that `FetchContent_Populate` is deprecated in 3.30 Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
1 parent b78db3b commit 458952e

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,26 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
562562
cmake_policy(SET CMP0135 NEW)
563563
endif()
564564

565-
FetchContent_Declare(KleidiAI_Download
566-
URL ${KLEIDIAI_DOWNLOAD_URL}
565+
# Prepare arguments for FetchContent
566+
set(KLEIDIAI_Download_ARGS
567567
DOWNLOAD_EXTRACT_TIMESTAMP NEW
568-
URL_HASH MD5=${KLEIDIAI_ARCHIVE_MD5})
568+
URL ${KLEIDIAI_DOWNLOAD_URL}
569+
URL_HASH MD5=${KLEIDIAI_ARCHIVE_MD5}
570+
)
571+
572+
# Set EXCLUDE_FROM_ALL in FetchContent_MakeAvailable to avoid subproject targets (cmake 3.28+)
573+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
574+
list(APPEND KLEIDIAI_Download_ARGS EXCLUDE_FROM_ALL)
575+
endif()
576+
577+
FetchContent_Declare(KleidiAI_Download ${KLEIDIAI_Download_ARGS})
578+
579+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
580+
FetchContent_MakeAvailable(KleidiAI_Download)
581+
else()
582+
FetchContent_Populate(KleidiAI_Download)
583+
endif()
569584

570-
FetchContent_MakeAvailable(KleidiAI_Download)
571585
FetchContent_GetProperties(KleidiAI_Download
572586
SOURCE_DIR KLEIDIAI_SRC
573587
POPULATED KLEIDIAI_POPULATED)
@@ -578,11 +592,6 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
578592

579593
add_compile_definitions(GGML_USE_CPU_KLEIDIAI)
580594

581-
# Remove kleidiai target after fetching it
582-
if (TARGET kleidiai)
583-
set_target_properties(kleidiai PROPERTIES EXCLUDE_FROM_ALL TRUE)
584-
endif()
585-
586595
list(APPEND GGML_CPU_SOURCES
587596
ggml-cpu/kleidiai/kleidiai.cpp
588597
ggml-cpu/kleidiai/kernels.cpp

0 commit comments

Comments
 (0)