Skip to content

Commit c594b20

Browse files
authored
fix(cmake): POCO_SANITIZEFLAGS with multiple flags is passed to the compiler un-split #5402 (#5403)
1 parent 0b3c9d2 commit c594b20

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

cmake/DefinePlatformSpecific.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ else(MSVC)
8989
endif(MSVC)
9090

9191
if (DEFINED POCO_SANITIZEFLAGS AND NOT "${POCO_SANITIZEFLAGS}" STREQUAL "")
92-
message(STATUS "Using sanitize flags: ${POCO_SANITIZEFLAGS}")
93-
add_compile_options(${POCO_SANITIZEFLAGS})
94-
add_link_options(${POCO_SANITIZEFLAGS})
92+
# separate_arguments splits the space-separated string into individual
93+
# tokens. Passing the raw variable to add_compile_options would treat a
94+
# multi-flag value (e.g. "-fsanitize=undefined -fno-sanitize=vptr") as a
95+
# single argument, which the compiler rejects; CMake only splits on ';'.
96+
separate_arguments(_poco_san_flags UNIX_COMMAND "${POCO_SANITIZEFLAGS}")
97+
message(STATUS "Using sanitize flags: ${_poco_san_flags}")
98+
add_compile_options(${_poco_san_flags})
99+
add_link_options(${_poco_san_flags})
100+
unset(_poco_san_flags)
95101
endif()
96102

97103
#################################################################################

0 commit comments

Comments
 (0)