[CMake] CMake tutorial on Github

paul pfultz2 at yahoo.com
Thu Sep 21 11:36:26 EDT 2017


On Thu, 2017-09-21 at 16:23 +0200, Nagy-Egri Máté Ferenc via CMake wrote:
> Hi Paul!
>  
> I do not quite understand your comments.
>  
> Are you referring to the SFML distribution model? I am aware that
> deliberately forcing my end-users to ship a FindModule script sucks and I
> was not trying to promote that. 

Yes, you don't, but a casual user could possibly interpret it that way. The
same thing happens with cmake official documentation, even though it clearly
states a FindModule "is not shipped with upstream". 

> I just said that it happens. The part where you say „emphasize that is for
> upstream libraries not downstream users”. How can I create a FindModule
> script FOR an upstream? Upstream is done. It’s compiled. Who else could the
> target audience of a FindModule script be, other other than a downstream
> user?

Yea, I think the directions here is confusing. That is, in my library, I
create a FindModule to use an upstream library because the upstream library
doesn't support cmake. However, in my library, I create a config file to
support cmake for downstream users.

> How can CMAKE_PREFIX_PATH be considered desirable over the package registry?
> I compile something, install and, register it, done. Fire and forget. I
> don’t think that either specifying toolchain files or specifying
> CMAKE_PREFIX_PATH are better than simply specifying… nothing?

If I want to install multiple versions of the library(or libraries) in
different locations, that is one with `CMAKE_INSTALL_PREFIX=/opt/a` and
another with `CMAKE_INSTALL_PREFIX=/opt/b`, it can leads to lots of problems.
Implicitly changing where cmake searches will cause unnecessary headaches, and
it is rarely done(even the clFFT example doesn't do this). There are other
issues as well: it can't be done system-wide portably. It only can help find
config packages, whereas `CMAKE_PREFIX_PATH` can help tell where dependencies
are when using any of the `find_*` commands in cmake. 

Of course, I am not saying to remove the section, but rather discuss how
`CMAKE_PREFIX_PATH` can be used to tell cmake where your dependencies are
installed.

.


More information about the CMake mailing list