Skip to content

Commit

Permalink
build(c): set -Og -ggdb and warn about Conda setting -O2
Browse files Browse the repository at this point in the history
Fixes #1608.
  • Loading branch information
lidavidm committed Mar 12, 2024
1 parent 27d62c3 commit 8b08a1c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion c/cmake_modules/AdbcDefines.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
endif()

# Set common build options
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${ADBC_BUILD_WARNING_LEVEL}" STREQUAL "")
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${_lower_build_type}" STREQUAL "release")
set(ADBC_BUILD_WARNING_LEVEL "PRODUCTION")
else()
Expand Down Expand Up @@ -92,6 +92,26 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
-Werror
-Wno-unused-parameter)
set(ADBC_C_CXX_FLAGS_PRODUCTION -Wall)

if(NOT CMAKE_C_FLAGS_DEBUG MATCHES "-O")
string(APPEND CMAKE_C_FLAGS_DEBUG " -Og")
endif()
if(NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "-O")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
endif()

if(NOT CMAKE_C_FLAGS_DEBUG MATCHES "-g")
string(APPEND CMAKE_C_FLAGS_DEBUG " -g3")
endif()
if(NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "-g")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -g3")
endif()
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-g")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -g3")
endif()
if(NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-g")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -g3")
endif()
else()
message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
Expand Down

0 comments on commit 8b08a1c

Please sign in to comment.