diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-09-08 04:32:04 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-09-08 11:34:29 +0000 |
commit | df21aa90250c29d7466d55d9e0eda2cddd0dfbd8 (patch) | |
tree | e5fdd84a9b01114bedd293c534d161a64ee77f69 /CMakeLists.txt | |
parent | 935c055c18c8e33021c4062d22d4b87fe5577662 (diff) |
Use cmake_push_check_state() and cmake_pop_check_state().
Change-Id: I70528d5f54f62a51bf6f438669cd70d5f0296ae5
Reviewed-on: https://code.wireshark.org/review/23435
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c57f4f7a47..7bd2f4a2eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -701,11 +701,14 @@ foreach(THIS_FLAG ${CXX_WARN_TESTS}) endforeach() set(WS_WARNINGS_CXX_FLAGS ${ADDED_WARN_CXX_FLAGS}) +include(CMakePushCheckState) + if(ENABLE_ASAN) + cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES "-fsanitize=address") check_c_compiler_flag(-fsanitize=address C__fsanitize_address_VALID) check_cxx_compiler_flag(-fsanitize=address CXX__fsanitize_address_VALID) - set(CMAKE_REQUIRED_LIBRARIES "") + cmake_pop_check_state() if(NOT C__fsanitize_address_VALID OR NOT CXX__fsanitize_address_VALID) message(FATAL_ERROR "ENABLE_ASAN was requested, but not supported!") endif() @@ -720,10 +723,11 @@ if(ENABLE_ASAN) endif() if(ENABLE_UBSAN) + cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES "-fsanitize=undefined") check_c_compiler_flag(-fsanitize=undefined C__fsanitize_undefined_VALID) check_cxx_compiler_flag(-fsanitize=undefined CXX__fsanitize_undefined_VALID) - set(CMAKE_REQUIRED_LIBRARIES "") + cmake_pop_check_state() if(NOT C__fsanitize_undefined_VALID OR NOT CXX__fsanitize_undefined_VALID) message(FATAL_ERROR "ENABLE_UBSAN was requested, but not supported!") endif() |