only add compiler flags for tests
+if(MSVC)
+ add_compile_options(
+ $<$<CONFIG:>:/MT> #---------|
+ $<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
+ $<$<CONFIG:Release>:/MT> #--|
+ )
+endif()
+
+# Turn on strict compiler flags only for testing to allow better compatability with diverse platforms.
+if(UNIT_TESTING)
if(MSVC)
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "/WX")
@@ -5,12 +15,6 @@ if(MSVC)
endif()
add_compile_options(/W4 ${WARNINGS_AS_ERRORS_FLAG} /wd5031 /wd4668 /wd4820 /wd4255 /wd4710 /analyze)
-
- add_compile_options(
- $<$<CONFIG:>:/MT> #---------|
- $<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
- $<$<CONFIG:Release>:/MT> #--|
- )
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
@@ -26,3 +30,4 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
else()
message(WARNING "Using an unsupported compiler. Disabling stricter compiler flags.")
endif()
+endif()
