CMakeLists.txt (FT_ENABLE_ERROR_STRINGS): New configuration option. This option uncomments FreeType configuration macro `FT_CONFIG_OPTION_ERROR_STRINGS` to make function `FT_Error_String` return meaningful error strings. This option is off by default.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index feb4be3..dff5b4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,8 @@
#
# Some notes.
#
+# - Say `cmake -LAH` to see all configuration options.
+#
# - `cmake' creates configuration files in
#
# <build-directory>/include/freetype/config
@@ -215,6 +217,8 @@ cmake_dependent_option(FT_REQUIRE_BROTLI
"Require support of compressed WOFF2 fonts." OFF
"NOT FT_DISABLE_BROTLI" OFF)
+option(FT_ENABLE_ERROR_STRINGS
+ "Enable support for meaningful error descriptions." OFF)
# Disallow in-source builds
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
@@ -354,6 +358,12 @@ if (BROTLIDEC_FOUND)
FTOPTION_H "${FTOPTION_H}")
endif ()
+if (FT_ENABLE_ERROR_STRINGS)
+ string(REGEX REPLACE
+ "/\\* +(#define +FT_CONFIG_OPTION_ERROR_STRINGS) +\\*/" "\\1"
+ FTOPTION_H "${FTOPTION_H}")
+endif ()
+
set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
if (EXISTS "${FTOPTION_H_NAME}")
file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H)