diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9d93e7e32..fd831be25 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,11 +11,18 @@ project(lvgl_tests LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_C_STANDARD 99) +set(FLAG_CHECK_WHITELIST --coverage -fsanitize=address) + include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) function(filter_compiler_options lang options_out) set(options ${ARGN}) foreach(option ${options}) + if (option IN_LIST FLAG_CHECK_WHITELIST) + list(APPEND ${options_out} ${option}) + continue() + endif () + string(TOUPPER FLAG_SUPPORTED_FOR_${lang}_${option} option_var_name) if (${lang} STREQUAL C) @@ -94,14 +101,12 @@ elseif (OPTIONS_FULL_32BIT) set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_FULL_32BIT}) elseif (OPTIONS_TEST_SYSHEAP) set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP} -fsanitize=address -fsanitize=leak -fsanitize=undefined --coverage) - filter_compiler_options (C TEST_LIBS --coverage -fsanitize=leak -fsanitize=undefined) - list(APPEND TEST_LIBS -fsanitize=address) + filter_compiler_options (C TEST_LIBS --coverage -fsanitize=address -fsanitize=leak -fsanitize=undefined) set (LV_CONF_BUILD_DISABLE_EXAMPLES ON) set (ENABLE_TESTS ON) elseif (OPTIONS_TEST_DEFHEAP) set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP}) - filter_compiler_options (C TEST_LIBS --coverage -fsanitize=leak -fsanitize=undefined) - list(APPEND TEST_LIBS -fsanitize=address) + filter_compiler_options (C TEST_LIBS --coverage -fsanitize=address -fsanitize=leak -fsanitize=undefined) set (LV_CONF_BUILD_DISABLE_EXAMPLES ON) set (ENABLE_TESTS ON) elseif (OPTIONS_TEST_MEMORYCHECK)