Skip to content

Commit

Permalink
cmake: move warnings to the top level, enable UBSan in debug builds
Browse files Browse the repository at this point in the history
While we're here, also request -fstrict-aliasing even for debug builds.

Signed-off-by: Kyle Evans <[email protected]>
  • Loading branch information
kevans91 committed Jan 29, 2024
1 parent 72f5952 commit b5ca7c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ option(EXAMPLES "Install examples" ON)
option(MANPAGES "Install manpages" ON)
option(BUILD_DRIVER "Build the orch(1) driver" ON)

set(warnings "-Wall -Wextra -Werror")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
add_compile_options(-fsanitize=address,undefined -fstrict-aliasing)
add_link_options(-fsanitize=address,undefined -fstrict-aliasing)
endif()

if(EXAMPLES)
Expand Down
1 change: 0 additions & 1 deletion lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

file(GLOB core_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)

set(warnings "-Wall -Wextra -Werror")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
add_compile_options(-D_GNU_SOURCE)
endif()
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

file(GLOB orch_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)

set(warnings "-Wall -Wextra -Werror")
add_compile_definitions(ORCHLUA_PATH="${ORCHLUA_PATH}")

add_executable(orch ${orch_SOURCES})
Expand Down

0 comments on commit b5ca7c2

Please sign in to comment.