kdelibs FindFreetype.cmake broken: any ideas?

Benjamin Reed rangerrick at gmail.com
Fri Apr 6 16:38:48 CEST 2007


FindFreetype in kdelibs/cmake/modules seems to have an issue.

Currently, it does this:

---(snip!)---
    EXEC_PROGRAM(${FREETYPECONFIG_EXECUTABLE} ARGS --cflags
RETURN_VALUE _return_VALUE OUTPUT_VARIABLE FREETYPE_INCLUDE_DIR)
    if(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
      set(FREETYPE_FOUND TRUE)
      #message(STATUS "Found freetype: ${FREETYPE_LIBRARIES}")
      STRING(REGEX REPLACE "-I(.+)" "\\1" FREETYPE_INCLUDE_DIR
"${FREETYPE_INCLUDE_DIR}")
    endif(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
---(snip!)---

When I try to build something that does:

  INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIR} )

I end up with this on the compile line:

  -I/opt/kde4-deps/include/freetype2\ -I/opt/kde4-deps/include

Note that it's escaping the space between the entries.  Does
INCLUDE_DIRECTORIES expect a single discrete directory as it's
argument?  My suspicion is that the regex is replacing only the first
-I, and ending up with the string "/opt/kde4-deps/include/freetype2
-I/opt/kde4-deps/include" as FREETYPE_INCLUDE_DIR which is wrong.  :)

(the reason there's 2 directories in freetype-config's output is
ft2build.h is in include/ but the rest of the includes are in
include/freetype2)

Any ideas how to resolve this?  Is there an "array" type that can be
passed to INCLUDE_DIRECTORIES in cmake?  Or are we going to have to
change anything using FindFreetype to add defines instead of setting
INCLUDE_DIRECTORIES (ugh)


More information about the Kde-buildsystem mailing list