[cmake-developers] Using cmake pkg-config-like in non-cmake builds
Brad King
brad.king at kitware.com
Mon Nov 22 16:06:05 EST 2010
On 11/22/2010 03:55 PM, Alexander Neundorf wrote:
> I have a slightly different idea: instead of having cmake generate pc-files,
> modify/extend cmake so that it can be used similar to pkg-config by projects
> which don't use cmake as their buildsystem.
Interesting.
> It already somewhat works:
> $ cmake -DMODE=COMPILE -DCOMPILER_ID=GNU -DPACKAGE=PNG -P cmake-config.cmake
> -I/usr/include -I/usr/include
>
> $ cmake -DMODE=LINK -DCOMPILER_ID=GNU -DPACKAGE=PNG -P cmake-config.cmake
> /usr/lib/libpng.so /usr/lib/libz.so
>
> Do you think this makes sense ?
Yes. It might be hard to do in non-toy cases though.
> Current issues:
> * the output goes to stderr instead stdout
> * the output has line breaks
> * actual problem: currently it's not possible to use commands which deal with
> targets in script-mode (I disabled that in 2007 since at least back then it
> didn't make sense). This means that find-modules which use try_compile()
> internally fail, and also those which create imported targets.
Consider implementing the outer-most script in bash (or plain bourne shell).
Internally it can run "cmake" on a test project that prints information
during its configuration but never builds. Then you can use sed to parse
out the results.
> Do you think it is worth to put some effort into this ?
I'm not going to spend time on it but I can review what others produce.
-Brad
More information about the cmake-developers
mailing list