This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new bad064f705 MINOR: [C++] Ensure setting the default CMAKE_BUILD_TYPE 
(#43794)
bad064f705 is described below

commit bad064f705ec9fc72efac2d13a1fc3fac6d3d137
Author: Vyas Ramasubramani <[email protected]>
AuthorDate: Thu Aug 22 14:08:26 2024 -0700

    MINOR: [C++] Ensure setting the default CMAKE_BUILD_TYPE (#43794)
    
    
    
    ### Rationale for this change
    
    The current logic for detecting whether the `CMAKE_BUILD_TYPE` is set is 
incorrect. That variable is never fully undefined; by default, in cases where 
it is unset is actually set to the empty string. Therefore, the condition that 
must be checked is not whether the variable is defined, but whether it tests to 
a truthy value (i.e. is a non-empty string).
    
    I consider this a minor change so I have not opened an associated issue.
    
    ### What changes are included in this PR?
    
    This PR changes `if(NOT DEFINED CMAKE_BUILD_TYPE)` to `if(NOT 
CMAKE_BUILD_TYPE)`.
    
    ### Are these changes tested?
    
    Since this fixes a particular CMake build scenario I am not sure if a test 
is merited, or where one would be added.
    
    ### Are there any user-facing changes?
    
    No.
    
    Authored-by: Vyas Ramasubramani <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/CMakeLists.txt                        | 2 +-
 cpp/examples/minimal_build/CMakeLists.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a1e3138da9..5ead9e4b06 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -84,7 +84,7 @@ set(ARROW_VERSION "18.0.0-SNAPSHOT")
 string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" ARROW_BASE_VERSION 
"${ARROW_VERSION}")
 
 # if no build type is specified, default to release builds
-if(NOT DEFINED CMAKE_BUILD_TYPE)
+if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE
       Release
       CACHE STRING "Choose the type of build.")
diff --git a/cpp/examples/minimal_build/CMakeLists.txt 
b/cpp/examples/minimal_build/CMakeLists.txt
index b4a7cde938..95dad34221 100644
--- a/cpp/examples/minimal_build/CMakeLists.txt
+++ b/cpp/examples/minimal_build/CMakeLists.txt
@@ -30,7 +30,7 @@ endif()
 # We require a C++17 compliant compiler
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-if(NOT DEFINED CMAKE_BUILD_TYPE)
+if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
 endif()
 

Reply via email to