On distributions like NixOS, which build packages in a sandbox, fontconfig configuration files may not be available at build time, which leads to the following cmake warnings even if the font itself is available: Fontconfig error: Cannot load default config file CMake Warning at CMakeLists.txt:62 (message): Could not find font FreeSans! This commit allows to specify exact font location on cmake commandline via -DTT_FONT_FILE=... When specified, automatic font look up via fc-list is skipped. Signed-off-by: Michal Sojka <michal.sojka@xxxxxxx> --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efcccb1..c4731c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,8 +50,10 @@ find_package(OpenGL) find_package(GLUT) set(KS_FONT FreeSans) -execute_process(COMMAND bash "-c" "fc-list '${KS_FONT}' |grep ${KS_FONT}.ttf | cut -d':' -f 1 -z" - OUTPUT_VARIABLE TT_FONT_FILE) +if (NOT TT_FONT_FILE) + execute_process(COMMAND bash "-c" "fc-list '${KS_FONT}' |grep ${KS_FONT}.ttf | cut -d':' -f 1 -z" + OUTPUT_VARIABLE TT_FONT_FILE) +endif (NOT TT_FONT_FILE) if (TT_FONT_FILE) -- 2.30.1