diff --git a/CMakeLists.txt b/CMakeLists.txt index 696ec1af80..1933ca70f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,24 +194,21 @@ if (DUSK_MOVIE_SUPPORT) endif () endif () -if (CMAKE_SYSTEM_NAME STREQUAL Linux) +if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") # -Wno-multichar: Multi-character constants ('ABCD') are implementation-defined but all compilers # (CW, GCC, Clang, MSVC) encode them identically in big-endian order. # For >4-char literals (which GCC/Clang truncate to int), use the MULTI_CHAR() macro. # -Wdeprecated-declarations: JSystem uses std::iterator, deprecated in C++17 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -Wno-trigraphs -Wno-deprecated-declarations") - set(CMAKE_INSTALL_RPATH "$ORIGIN") - set(CMAKE_BUILD_RPATH "$ORIGIN") -elseif (APPLE) - add_compile_options(-Wno-declaration-after-statement -Wno-non-pod-varargs) - set(CMAKE_INSTALL_RPATH "@loader_path") - set(CMAKE_BUILD_RPATH "@loader_path") -elseif (MSVC) add_compile_options( - $<$:/bigobj> - $<$:/MP> - $<$:/FS> + $<$:-Wno-multichar> + $<$:-Wno-trigraphs> + $<$:-Wno-deprecated-declarations> + ) +elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + add_compile_options( + $<$:/bigobj> + $<$:/MP> + $<$:/FS> ) if (NOT DUSK_BUILD_WARNINGS) @@ -226,6 +223,15 @@ elseif (MSVC) add_compile_options($<$:/utf-8>) endif () +if (CMAKE_SYSTEM_NAME STREQUAL Linux) + set(CMAKE_INSTALL_RPATH "$ORIGIN") + set(CMAKE_BUILD_RPATH "$ORIGIN") +elseif (APPLE) + add_compile_options(-Wno-declaration-after-statement -Wno-non-pod-varargs) + set(CMAKE_INSTALL_RPATH "@loader_path") + set(CMAKE_BUILD_RPATH "@loader_path") +endif () + include(FetchContent) # Declare all dependencies first so CMake can download them in parallel