Skip to content

Commit

Permalink
build: Clean up compile_option after FindSanitizers module
Browse files Browse the repository at this point in the history
Unset the `compile_option` variable after it's used in the FindSanitizers
module to prevent potential conflicts with other CMake build configurations.
Previously, this variable persisted after `find_package(Sanitizers)`,
which could lead to unexpected build behavior if the same variable name
was used elsewhere.

This change follows CMake best practices where Find modules clean up
temporary variables after use.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov authored and avikivity committed Nov 25, 2024
1 parent 0d1781c commit 7dbd974
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmake/FindSanitizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ foreach (component ${Sanitizers_FIND_COMPONENTS})
message (FATAL_ERROR "Unsupported sanitizer: ${component}")
endif ()
list(APPEND Sanitizers_COMPILE_OPTIONS "${${compile_options}}")
unset (compile_options)
endforeach ()

include(CheckCXXSourceCompiles)
Expand Down

0 comments on commit 7dbd974

Please sign in to comment.