Skip to content

Commit

Permalink
CMakeLists.txt - Fix omission in CMAKE_CXX_FLAGS_DEBUG (#338)
Browse files Browse the repository at this point in the history
When building with `-DCMAKE_BUILD_TYPE=Debug`, using clang, the wrong
`CMAKE_C_FLAGS_DEBUG` are set, which causes a wrong debug build. This
issue is caused by 0043452, which sets `CMAKE_CXX_FLAGS_DEBUG` to the
correct flags, but later is set to `CMAKE_CXX_FLAGS`, which is empty.

Issue does not occur when building with a different compiler.
  • Loading branch information
bket authored Aug 4, 2024
1 parent 4c8b021 commit 8d2c00e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -pthread -g -DDEBUG -Weverything -Wno-c++98-compat" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "-O0 -pthread -g -DDEBUG -Weverything -Wno-c++98-compat" CACHE STRING "" FORCE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "-O0 -pthread -g -DDEBUG -Wall -Wextra" CACHE STRING "" FORCE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Expand Down

0 comments on commit 8d2c00e

Please sign in to comment.