--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -109,7 +109,7 @@ if (WIN32 AND NOT MINGW AND NOT MSYS)
   #	SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
 
   if (BUILD_STATIC_LIBS)
-    SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
+    SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS BGD_NONDLL=1)
   endif()
 
 ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
--- a/src/gd.h
+++ b/src/gd.h
@@ -40,14 +40,14 @@ extern "C" {
    and other languages. This breaks ABI compatibility
    with previous DLL revs, but it's necessary. */
 
-/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
+/* 2.0.29: WIN32 programmers can declare the BGD_NONDLL macro if they
    wish to build gd as a static library or by directly including
    the gd sources in a project. */
 
 /* http://gcc.gnu.org/wiki/Visibility */
 #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
 # ifdef BGDWIN32
-#  ifdef NONDLL
+#  ifdef BGD_NONDLL
 #   define BGD_EXPORT_DATA_PROT
 #  else
 #   ifdef __GNUC__
