Fix: [CMake] restore CMAKE_REQUIRED_FLAGS if you change it (#13393)

This commit is contained in:
Patric Stout
2025-01-27 20:41:51 +01:00
committed by GitHub
parent a7deb16e81
commit 119470f43e
3 changed files with 9 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
# Autodetect if xaudio2 can be used.
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "")
check_cxx_source_compiles("
@@ -17,3 +18,5 @@ check_cxx_source_compiles("
int main() { printf(\"%s\\\\n\", XAUDIO2_DLL_A); return 0; }"
XAUDIO2_FOUND
)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})