Add a check of MSVC variable before setting flags that link the libra… (#814)
* Add a check of MSVC variable before setting flags that link the library with the MSVC static runtime
* Move MSVC guard inside the 'foreach' loop used to force static runtime link
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d8885d..12a7938 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -317,8 +317,10 @@
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
- STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
- SET("${flag}" "${${flag}} /EHsc")
+ if (MSVC)
+ STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
+ SET("${flag}" "${${flag}} /EHsc")
+ endif (MSVC)
ENDFOREACH()
endif ()