multiple pathes in cmake variables
William A. Hoffman
billlist at nycap.rr.com
Sat Feb 11 17:32:49 CET 2006
At 11:17 AM 2/11/2006, Alexander Neundorf wrote:
>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} ...)
CMAKE_INCLUDE_PATH should NOT be listed in any cmake list file.
It is automatically used by find_path see cmFindPathCommand.cxx and
cmMakefile::GetIncludeSearchPath. Same thing goes for CMAKE_LIBRARY_PATH.
-Bill
More information about the Kde-buildsystem
mailing list