[CMake] INCLUDE_DIRECTORIES oddity
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Sat Mar 24 15:24:20 EST 2007
> Hello,
> I'm experiencing an odd behaviour of the INCLUDE_DIRECTORY command.
> Here's the relevant code:
>
> INCLUDE(UsePkgConfig)
> FOREACH(library sdl libpng freetype2)
> PKGCONFIG(${library} INC LIB LD C)
> IF(C)
> INCLUDE_DIRECTORIES(${C})
> TARGET_LINK_LIBRARIES(wowtris ${LD})
> ELSE(C)
> MESSAGE(FATAL_ERROR "${library} is missing.")
> ENDIF(C)
> ENDFOREACH(library)
I think you will find the source of your trouble is the PKGCONFIG macro.
Dump out ${C} and ${LD} inside the FOREACH loop, and I believe you will see
space-separated strings which you will have to convert to lists (semi-colon
separated strings) before using them in INCLUDE_DIRECTORIES and
TARGET_LINK_LIBRARIES.
There is an outstanding replacement for PKGCONFIG in the CVS version of
CMake called PKG_CHECK_MODULES which is in the "find" module
FindPkgConfig.cmake. Simultaneously, UsePkgConfig.cmake and the included
PKGCONFIG macro are deprecated in CVS.
Question for the CMake developers: is FindPkgConfig.cmake and PKGCONFIG with
deprecation message going into 2.4.7? It would be good to finally put to
rest these "blank-separated" and other issues with PKGCONFIG that all new
users seem to encounter. (Actually, all questions about the CVS versions of
FindPkgConfig.cmake and UsePkgConfig.cmake were settled prior to 2.4.6, but
somehow those tested CVS versions did not make it into that release.)
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list