[CMake] problems detecting a required version of a library

Scott Amort jsamort at gmail.com
Tue Jun 27 23:05:05 EDT 2006


Hello,

I am in the process of converting my C++ library project from autotools
to CMake.  So far, things are working very well.  However, I have come
across a strange problem.  I have written a cmake module that attempts
to detect if ANTLR is installed, by checking antlr-config (this is all
done on Linux, btw).  I'm using EXECUTE_PROCESS to call `antlr-config
--libs', which outputs a value that I can add to TARGET_LINK_LIBRARIES
(something like /usr/lib/libantlr.a).  However, it seems to be having
some trouble with end-of-line characters.  Once I run this, I get a
strange error about an unexpected ; in CMakeCache.txt.  If I remove the
library value from TARGET_LINK_LIBRARIES, the error goes away.  I can
use pkgconfig instead, but then all I get is -lantlr, with no -L path
information to add to TARGET_LINK_LIBRARIES.  I can just use
FIND_LIBRARY, but then I am without version information (I need to have
a specific version installed and I can obtain that info either from
antlr-config or pkgconfig).  Has anyone else run across this problem, or
perhaps someone could point out a better way for me to approach this?

Thanks very much,
Scott


More information about the CMake mailing list