Skip to content

Commit 271b3ac

Browse files
committed
Replace deprecated CMake FetchContent_Populate calls
In RapidJSON's case, we still call FetchContent_Populate because we only need the headers, but we do it in a non-deprecated way. Unfortunately, GIT_SUBMODULES is no longer respected, so gtest is fetched unnecessarily. This may be a CMake bug. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
1 parent bb6315b commit 271b3ac

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

CMake/FindCURL.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ if(${BUILD_CURL_FROM_SOURCE})
1414
# In libcurl, CMakeLists build static lib is broken add build command via
1515
# make
1616
if(NOT TARGET libcurl_static_build)
17-
if (NOT curl_bundle_POPULATED)
18-
FetchContent_Populate(curl_bundle)
19-
endif()
17+
FetchContent_MakeAvailable(curl_bundle)
2018
find_package(OpenSSL)
2119
add_custom_command(
2220
OUTPUT ${curl_bundle_BINARY_DIR}/lib/libcurl.a

CMake/FindOpenSSL.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ if(${BUILD_CURL_FROM_SOURCE})
1414
FetchContent_GetProperties(openssl102)
1515

1616
if(NOT TARGET openssl102_static_build)
17-
if(NOT openssl102_POPULATED)
18-
FetchContent_Populate(openssl102)
19-
endif()
17+
FetchContent_MakeAvailable(openssl102)
2018
add_custom_command(
2119
OUTPUT ${openssl102_BINARY_DIR}/lib/libssl.a
2220
WORKING_DIRECTORY ${openssl102_SOURCE_DIR}

CMake/Finde2fs.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ if(NOT ORIGIN_EXT2FS)
99
FetchContent_GetProperties(e2fsprogs)
1010

1111
if(NOT TARGET libext2fs_build)
12-
if (NOT e2fsprogs_POPULATED)
13-
FetchContent_Populate(e2fsprogs)
14-
endif()
12+
FetchContent_MakeAvailable(e2fsprogs)
1513
set(LIBEXT2FS_INSTALL_DIR ${e2fsprogs_SOURCE_DIR}/build/libext2fs CACHE STRING "")
1614

1715
add_custom_command(

CMake/Findrapidjson.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
FetchContent_Declare(
2-
rapidjson
3-
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
4-
GIT_TAG 80b6d1c83402a5785c486603c5611923159d0894
5-
GIT_SUBMODULES ""
6-
)
7-
FetchContent_GetProperties(rapidjson)
81
if (NOT rapidjson_POPULATED)
9-
FetchContent_Populate(rapidjson)
2+
FetchContent_Populate(
3+
rapidjson
4+
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
5+
GIT_TAG 80b6d1c83402a5785c486603c5611923159d0894
6+
GIT_SUBMODULES ""
7+
)
108
endif()
9+
FetchContent_GetProperties(rapidjson)
1110

1211
add_definitions("-DRAPIDJSON_HAS_STDSTRING=1")

0 commit comments

Comments
 (0)