Skip to content

Commit 518263a

Browse files
committed
[#957] Handle empty SANITIZER string
Signed-off-by: Ziad Mostafa <[email protected]>
1 parent 4baae3e commit 518263a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

iceoryx2-cmake-modules/modules/Iceoryx2CommonOptionsAndParams.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ if(NOT ICEORYX2_COMMON_OPTIONS_AND_PARAMS_LISTED)
3131

3232
add_param(
3333
NAME SANITIZERS
34-
TYPE STRING
35-
DESCRIPTION "Sanitizer configuration: 'address', 'ub', 'address;ub', or 'thread'"
34+
DESCRIPTION "Sanitizer configuration: 'address', 'ub', 'address;ub', 'thread', or empty string (disabled)"
3635
DEFAULT_VALUE ""
3736
)
3837

iceoryx2-cmake-modules/modules/Iceoryx2OptionAndParamMacros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endmacro()
2020
macro(add_param)
2121
set(ONE_VALUE_ARGS NAME DESCRIPTION DEFAULT_VALUE)
2222
cmake_parse_arguments(ADD_PARAM "" "${ONE_VALUE_ARGS}" "" ${ARGN})
23-
if(NOT ${ADD_PARAM_NAME})
23+
if(NOT DEFINED ${ADD_PARAM_NAME})
2424
set(${ADD_PARAM_NAME} ${ADD_PARAM_DEFAULT_VALUE})
2525
endif()
2626
message(STATUS " ${ADD_PARAM_NAME}: ${${ADD_PARAM_NAME}} (Description: ${ADD_PARAM_DESCRIPTION})")

iceoryx2-cmake-modules/modules/Iceoryx2Sanitizer.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
# Parse SANITIZERS string and set appropriate flags
1414
set(ICEORYX2_SANITZER_FLAGS "" CACHE INTERNAL "")
1515

16-
if(SANITIZERS STREQUAL "address")
16+
if(SANITIZERS STREQUAL "")
17+
# No sanitizers enabled - empty string is the default
18+
elseif(SANITIZERS STREQUAL "address")
1719
set(ICEORYX2_SANITZER_FLAGS -fsanitize=address CACHE INTERNAL "")
1820
elseif(SANITIZERS STREQUAL "ub")
1921
set(ICEORYX2_SANITZER_FLAGS -fsanitize=undefined CACHE INTERNAL "")
2022
elseif(SANITIZERS STREQUAL "address;ub")
2123
set(ICEORYX2_SANITZER_FLAGS -fsanitize=address -fsanitize=undefined CACHE INTERNAL "")
2224
elseif(SANITIZERS STREQUAL "thread")
2325
set(ICEORYX2_SANITZER_FLAGS -fsanitize=thread CACHE INTERNAL "")
24-
elseif(NOT SANITIZERS STREQUAL "")
25-
message(FATAL_ERROR "Invalid SANITIZERS value: '${SANITIZERS}'. Valid options are: 'address', 'ub', 'address;ub', or 'thread'")
26+
else()
27+
message(FATAL_ERROR "Invalid SANITIZERS value: '${SANITIZERS}'. Valid options are: 'address', 'ub', 'address;ub', 'thread', or empty string (disabled)")
2628
endif()

0 commit comments

Comments
 (0)