Skip to content

Commit

Permalink
GH-39268: [C++] Don't install bundled Azure SDK for C++ with CMake 3.…
Browse files Browse the repository at this point in the history
…28+ (#39269)

### Rationale for this change

We can implement this by specifying `EXCLUDE_FROM_ALL TRUE` to `fetchcontent_declare()`.

### What changes are included in this PR?

Specify `EXCLUDE_FROM_ALL TRUE` only with CMake 3.28+.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: #39268

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
kou authored Jan 1, 2024
1 parent 1369630 commit 4543f5d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,10 @@ else()
endif()

include(FetchContent)
set(FC_DECLARE_COMMON_OPTIONS)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
list(APPEND FC_DECLARE_COMMON_OPTIONS EXCLUDE_FROM_ALL TRUE)
endif()

macro(prepare_fetchcontent)
set(BUILD_SHARED_LIBS OFF)
Expand Down Expand Up @@ -2146,6 +2150,9 @@ function(build_gtest)
message(STATUS "Building gtest from source")
set(GTEST_VENDORED TRUE)
fetchcontent_declare(googletest
# We should not specify "EXCLUDE_FROM_ALL TRUE" here.
# Because we install GTest with custom path.
# ${FC_DECLARE_COMMON_OPTIONS}
URL ${GTEST_SOURCE_URL}
URL_HASH "SHA256=${ARROW_GTEST_BUILD_SHA256_CHECKSUM}")
prepare_fetchcontent()
Expand Down Expand Up @@ -5096,8 +5103,7 @@ function(build_azure_sdk)
endif()
message(STATUS "Building Azure SDK for C++ from source")
fetchcontent_declare(azure_sdk
# EXCLUDE_FROM_ALL is available since CMake 3.28
# EXCLUDE_FROM_ALL TRUE
${FC_DECLARE_COMMON_OPTIONS}
URL ${ARROW_AZURE_SDK_URL}
URL_HASH "SHA256=${ARROW_AZURE_SDK_BUILD_SHA256_CHECKSUM}")
prepare_fetchcontent()
Expand Down

0 comments on commit 4543f5d

Please sign in to comment.