diff --git a/CMakeLists.txt b/CMakeLists.txt
index af78061..8aba951 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,13 +39,15 @@ function(add_security_flags target)
             target_compile_options( ${target} PRIVATE -fstack-protector-strong)
         endif()
     elseif(WIN32)
-        target_compile_options( ${target} PRIVATE /GS /DynamicBase)
-        if(BUILD_WITH_STATIC_CRT)
-            target_compile_options( ${target} PRIVATE "/MT")
-        endif()
-        if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
-            # These options for 32 bit builds only
-            target_compile_options( ${target} PRIVATE /SAFESEH /NXCOMPAT )
+        if (MSVC)
+            target_compile_options( ${target} PRIVATE /GS /DynamicBase)
+            if(BUILD_WITH_STATIC_CRT)
+                target_compile_options( ${target} PRIVATE "/MT")
+            endif()
+            if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
+                # These options for 32 bit builds only
+                target_compile_options( ${target} PRIVATE /SAFESEH /NXCOMPAT )
+            endif()
         endif()
     endif()
 endfunction()
