diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-10-21 08:10:34 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-10-21 08:10:34 +0800 |
| commit | bbfffc8ce49b9afe854f0799513ab6b7891d6dab (patch) | |
| tree | d1b2a1cc8166270764b627960fa193b60e9b3271 /rcc/cmake/modules/CheckProblematicConfigurations.cmake | |
| parent | 49de843452f161ee42cb8f4ff4780ccc02ae3a7a (diff) | |
| download | rcc-project-bbfffc8ce49b9afe854f0799513ab6b7891d6dab.tar.gz rcc-project-bbfffc8ce49b9afe854f0799513ab6b7891d6dab.tar.xz | |
[CMake] Add RCC platform configuration checks
Diffstat (limited to 'rcc/cmake/modules/CheckProblematicConfigurations.cmake')
| -rw-r--r-- | rcc/cmake/modules/CheckProblematicConfigurations.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rcc/cmake/modules/CheckProblematicConfigurations.cmake b/rcc/cmake/modules/CheckProblematicConfigurations.cmake new file mode 100644 index 0000000..3b96db9 --- /dev/null +++ b/rcc/cmake/modules/CheckProblematicConfigurations.cmake @@ -0,0 +1,19 @@ + +option(RCC_ALLOW_PROBLEMATIC_CONFIGURATIONS OFF "Set this option to ON to allow problematic toolchain configurations. Use on your own risk.") + +macro(log_problematic MESSAGE) + if(RCC_ALLOW_PROBLEMATIC_CONFIGURATIONS) + message(WARNING "${MESSAGE}") + else() + message(FATAL_ERROR "${MESSAGE}\nYou can force usage of this configuration by passing -DRCC_ALLOW_PROBLEMATIC_CONFIGURATIONS=ON") + endif() +endmacro() + +# MSVC and /arch:AVX is untested and have created problems before. See: +# https://github.com/rcc/rcc-project/issues/54645 +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + string(TOLOWER "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" _FLAGS) + if(_FLAGS MATCHES "/arch:avx[0-9]*") + log_problematic("Compiling RCC with MSVC and the /arch:AVX flag is known to cause issues with parts of RCC.\nSee https://github.com/rcc/rcc-project/issues/54645 for details.\nUse clang-cl if you want to enable AVX instructions.") + endif() +endif() |
