[CMake] /path/to/libpng.so automatic conversion to -lpng ?

Eric Noulard eric.noulard at gmail.com
Thu Jul 13 07:13:42 EDT 2017


2017-07-13 13:01 GMT+02:00 René J. V. Bertin <rjvbertin at gmail.com>:

> Eric Noulard wrote:
>
> > From the command line I doubt it.
>
> Adding -DCMAKE_POLICY_DEFAULT_CMP0060=NEW on the commandline works.
>

Good to know.


>
> But whatever the reason, using PNG::PNG works too. Apparently policy 60
> doesn't
> affect the IMPORTED_LOCATION target property...
>

I guess this is expected and this is one advantage of imported library vs
plain path to lib.


> Did you try to use ninja generator instead of make ?
> > The no-op build is really faster with ninja.
>
> I compared single full builds with ninja and make yesterday; with ninja it
> was
> actually (a bit) slower and required more resources (including a larger
> build
> directory).


Do run make with parallel build?

I was speaking of a no-op build but for full build it may depends on your
main memory amount.
Ninja is parallel by default and in some case if you have many core (like 8
or more) but
not so much memory, ninja will generate as many compile/link job as you
have core (+2 I think)
which may be too much makes your system swap.

In that case you can control it yourself using
ninja -j <numberOfJob>
or
ninja -l <acceptedLoad>

My main gripe with it is that you cannot simply launch a partial
> build from a subdirectory.
>

Ninja generator is different is it not directory-based because you have a
single build.ninja file.
However you can easily build any (sub)directory of your project using:

ninja Path/To/Dir/all

-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170713/27e8fbcd/attachment.html>


More information about the CMake mailing list