Skip to content

Commit 2336cc4

Browse files
authored
cmake : use EXCLUDE_FROM_ALL to avoid patch-boringssl.cmake (ggml-org#17520)
We have to separate the code path starting 3.28 because `FetchContent_Populate` is now deprecated and will be completely removed in a future version. Signed-off-by: Adrien Gallouët <[email protected]>
1 parent e6923ca commit 2336cc4

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

vendor/cpp-httplib/CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,32 @@ if (LLAMA_BUILD_BORINGSSL)
3131

3232
message(STATUS "Fetching BoringSSL version ${BORINGSSL_VERSION}")
3333

34-
include(FetchContent)
35-
FetchContent_Declare(
36-
boringssl
34+
set(BORINGSSL_ARGS
3735
GIT_REPOSITORY ${BORINGSSL_GIT}
3836
GIT_TAG ${BORINGSSL_VERSION}
39-
PATCH_COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_SOURCE_DIR}/patch-boringssl.cmake"
4037
)
38+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
39+
list(APPEND BORINGSSL_ARGS EXCLUDE_FROM_ALL)
40+
endif()
41+
42+
include(FetchContent)
43+
FetchContent_Declare(boringssl ${BORINGSSL_ARGS})
4144

4245
set(SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
4346
set(SAVED_BUILD_TESTING ${BUILD_TESTING})
4447

4548
set(BUILD_SHARED_LIBS OFF)
4649
set(BUILD_TESTING OFF)
4750

48-
FetchContent_MakeAvailable(boringssl)
51+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
52+
FetchContent_MakeAvailable(boringssl)
53+
else()
54+
FetchContent_GetProperties(boringssl)
55+
if(NOT boringssl_POPULATED)
56+
FetchContent_Populate(boringssl)
57+
add_subdirectory(${boringssl_SOURCE_DIR} ${boringssl_BINARY_DIR} EXCLUDE_FROM_ALL)
58+
endif()
59+
endif()
4960

5061
set(BUILD_SHARED_LIBS ${SAVED_BUILD_SHARED_LIBS})
5162
set(BUILD_TESTING ${SAVED_BUILD_TESTING})

vendor/cpp-httplib/patch-boringssl.cmake

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)