diff --git a/cmake/ftxui_set_options.cmake b/cmake/ftxui_set_options.cmake
index d01cafe532a1d751a0af523835210923eed1623c..ad4acaae056ecf8ce9b9631062c8f4c0767e77ed 100644
--- a/cmake/ftxui_set_options.cmake
+++ b/cmake/ftxui_set_options.cmake
@@ -45,7 +45,7 @@ function(ftxui_set_options library)
 
   # Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
   # to the library and the library users.
-  if (MSVC)
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
     target_compile_options(${library} PUBLIC "/utf-8")
   endif()