diff --git a/CMakeLists.txt b/CMakeLists.txt index fada61d2..04539106 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,29 @@ If(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git") EndIf() EndIf() +# All Warnings, Extra Warnings, Pedantic +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # using Clang + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-missing-braces -Wmissing-field-initializers -Wno-c++98-compat-pedantic -Wold-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-covered-switch-default -Wno-switch-enum") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # GCC: -fpermissive is required as GCC does not allow the same template to be in different namespaces. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -fpermissive -Wno-long-long -Wno-missing-braces -Wmissing-field-initializers") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + # using Intel C++ +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Force to always compile with W4 + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() +endif() + +# C++ Standard and Extensions +## Use C++17 and no non-standard extensions. +SET(_CXX_STANDARD 17) +SET(_CXX_EXTENSIONS OFF) + # Define Project PROJECT( obs-stream-effects @@ -118,29 +141,6 @@ if(WIN32) ) endif() -# All Warnings, Extra Warnings, Pedantic -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - # using Clang - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-missing-braces -Wmissing-field-initializers -Wno-c++98-compat-pedantic -Wold-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-covered-switch-default -Wno-switch-enum") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # GCC: -fpermissive is required as GCC does not allow the same template to be in different namespaces. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -fpermissive -Wno-long-long -Wno-missing-braces -Wmissing-field-initializers") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - # using Intel C++ -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # Force to always compile with W4 - if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") - string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - endif() -endif() - -# C++ Standard and Extensions -## Use C++17 and no non-standard extensions. -SET(_CXX_STANDARD 17) -SET(_CXX_EXTENSIONS OFF) - ################################################################################ # Options ################################################################################