cmake: Add NO_CACHE_IF_FAILED option for checking linker flags

Use it for checking `-fsanitize`.

This change improves the user experience when the configuration step
fails due to a missing library. Now, there is no need to manually clean
the CMake cache after installing the required library.
This commit is contained in:
Hennadii Stepanov committed 2025-03-10 16:55:48 +00:00
1 parent 45719390a1
commit 52ac17757e
2 files changed
+6 -1

No files matched your search

+1
View File
@@ -376,6 +376,7 @@ if(SANITIZERS)
int main() { return 0; }
"
RESULT_VAR linker_supports_sanitizers
NO_CACHE_IF_FAILED
)
if(NOT linker_supports_sanitizers)
message(FATAL_ERROR "Linker did not accept requested flags, you are missing required libraries.")