diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d54ba2..a9d9982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,16 @@ if(NOT PLATFORM_DREAMCAST) set(FIND_LIBRARY_USE_LIB32_PATHS true) set(FIND_LIBRARY_USE_LIB64_PATHS false) else() - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra -ffp-contract=fast -mfsca -ffast-math") + include(CheckCCompilerFlag) + check_c_compiler_flag("-mfsrra" COMPILER_HAS_FSRRA) + check_c_compiler_flag("-mfsca" COMPILER_HAS_FSCA) + if(COMPILER_HAS_FSRRA) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra") + endif() + if(COMPILER_HAS_FSCA) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsca") + endif() + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -ffast-math") endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fexpensive-optimizations")