diff --git a/indra/cmake/GeneratePrecompiledHeader.cmake b/indra/cmake/GeneratePrecompiledHeader.cmake
index 19af8cda91a72e7a2c41cb7c490080531bfc35c9..fbb6cf187fe12a106c04a1be9929a3072e6b2bbb 100644
--- a/indra/cmake/GeneratePrecompiledHeader.cmake
+++ b/indra/cmake/GeneratePrecompiledHeader.cmake
@@ -68,7 +68,7 @@ macro(target_precompiled_header TARGET_NAME PRECOMPILED_HEADER PRECOMPILED_SOURC
             XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PRECOMPILED_HEADER}"
             XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES"
             )
-    elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
         # Create and set output directory.
         set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PRECOMPILED_HEADER_NAME}.gch")
         make_directory(${OUTPUT_DIR})