multiple pathes in cmake variables

Alexander Neundorf neundorf at kde.org
Sat Feb 11 17:17:40 CET 2006


Hi,

On Saturday 11 February 2006 11:14, Ralf Habacker wrote:
...
> There seems a bug in cmake.  In cmake/modules/FindlibXML2 the following
> config is required to detect libxml2
>
> FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
>   ${CMAKE_INCLUDE_PATH}/libxml2
>   ${_LibXml2IncDir}/libxml2
>   /usr/include/libxml2
>   /usr/local/include/libxml2
> )
>
> using
>
> cmake -DCMAKE_INCLUDE_PATH:PATH=c:\gnuwin32\include
>
> If more than one path is used in CMAKE_INCLUDE_PATH this detection will
> fail.
>
> cmake -DCMAKE_INCLUDE_PATH:PATH=c:\gnuwin32\include;c:\xyz\include
>
> the FIND_PATH function tried to find the include file libxml/xpath.h in
> "c:\gnuwin32\include;c:\xyz\include/libxml2" which fails as one path and
> not as  in c:\gnuwin32\include/libxml2 and c:\xyz\include/libxml2 expected.
>
> That means that multiple pathes in a variable and concatenation of
> additional subdirs dot not work in the FIND_PATH function or is there an
> alternative syntax to fix this problem ?

So the problem is that CMAKE_INCLUDE_PATH is a list and in the case above a 
subdir is appended to it.
This has to be fixed in FindFoo.cmake script, something like this (not tested, 
syntax may be incorrect):

set(allIncDirs)
foreach(incDir ${CMAKE_INCLUDE_PATH})
   set(allIncDirs ${allIncDirs} ${incDir}/libxml2)
endforeach(incDir ${CMAKE_INCLUDE_PATH})

find_path(... ${allIncDirs} ...)

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list