kou commented on code in PR #45306:
URL: https://github.com/apache/arrow/pull/45306#discussion_r2139469619
##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -1016,17 +1016,44 @@ set(FC_DECLARE_COMMON_OPTIONS)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
list(APPEND FC_DECLARE_COMMON_OPTIONS EXCLUDE_FROM_ALL TRUE)
endif()
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
+ list(APPEND FC_DECLARE_COMMON_OPTIONS SYSTEM)
+endif()
macro(prepare_fetchcontent)
- set(BUILD_SHARED_LIBS OFF)
- set(BUILD_STATIC_LIBS ON)
- set(CMAKE_COMPILE_WARNING_AS_ERROR FALSE)
- set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY TRUE)
- set(CMAKE_MACOSX_RPATH ${ARROW_INSTALL_NAME_RPATH})
+ set(BUILD_SHARED_LIBS
Review Comment:
I thought that they're local to a function/directory/... but they're global:
```cmake
# CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
cmake_policy(SET CMP0077 NEW)
project(xxx)
set(A OFF CACHE BOOL "" FORCE)
function(x)
message("IN FUNCTION BEFORE: ${A}")
set(A ON CACHE BOOL "" FORCE)
message("IN FUNCTION AFTER: ${A}")
endfunction()
message("OUT FUNCTION BEFORE: ${A}")
x()
message("OUT FUNCTION AFTER: ${A}")
message("OUT SUBDIRECTORY BEFORE: ${A}")
add_subdirectory(sub)
message("OUT SUBDIRECTORY AFTER: ${A}")
```
```cmake
# sub/CMakeLists.txt
message("IN SUBDIRECTORY BEFORE: ${A}")
set(A OFF CACHE BOOL "" FORCE)
message("IN SUBDIRECTORY AFTER: ${A}")
```
```console
$ rm -rf build && cmake -S . -B build
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
OUT FUNCTION BEFORE: OFF
IN FUNCTION BEFORE: OFF
IN FUNCTION AFTER: ON
OUT FUNCTION AFTER: ON
OUT SUBDIRECTORY BEFORE: ON
IN SUBDIRECTORY BEFORE: ON
IN SUBDIRECTORY AFTER: OFF
OUT SUBDIRECTORY AFTER: OFF
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /var/tmp/zzz/build
```
Hmm. We may need to use another approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]