From af99090742fdb3e7de5572aa2006be228f2311cc Mon Sep 17 00:00:00 2001
From: Jamie Seward <jamie.d.seward@gmail.com>
Date: Mon, 16 Oct 2017 01:02:48 -0700
Subject: [PATCH] Disable warning C4389: '==': signed/unsigned mismatch

Lots of tests have this warning.

Also moved out of for loop, doesn't need to be done every loop.
---
 test/CMakeLists.txt | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 26b474c0..b51aff76 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -66,6 +66,19 @@ set_target_properties(catch_main PROPERTIES
 )
 target_include_directories(catch_main PRIVATE "thirdparty/catch")
 
+# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
+if(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()
+
+    # Disable warning C4389: '==': signed/unsigned mismatch
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4389")
+endif()
+
 #############################################################################
 # one executable for each unit test file
 #############################################################################
@@ -91,16 +104,6 @@ foreach(file ${files})
         set_target_properties(${testcase} PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-float-equal")
     endif()
 
-    # https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
-    if(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()
-
     add_test(NAME "${testcase}_default"
       COMMAND ${testcase} ${CATCH_TEST_FILTER}
       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}