diff --git a/portfile.cmake b/portfile.cmake
index ce1b868..fd57c3e 100644
--- a/portfile.cmake
+++ b/portfile.cmake
@@ -48,4 +48,22 @@ vcpkg_fixup_cmake_targets()
 
 vcpkg_copy_pdbs()
 
+file(READ "${CURRENT_PACKAGES_DIR}/include/FreeImage.h" _header_data)
+string(REPLACE
+    "typedef int32_t BOOL;"
+    "#define BOOL int32_t"
+    _header_data
+    "${_header_data}"
+)
+
+string(REPLACE
+    "#endif // FREEIMAGE_H"
+    "#undef BOOL
+    #endif // FREEIMAGE_H"
+    _header_data
+    "${_header_data}"
+)
+
+file(WRITE "${CURRENT_PACKAGES_DIR}/include/FreeImage.h" "${_header_data}")
+
 file(INSTALL ${SOURCE_PATH}/license-fi.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
