[CMake] Abuse of find_package COMPONENTS, or not?

Philip Lowman philip at yhbt.com
Wed May 20 23:00:37 EDT 2009


On Wed, May 20, 2009 at 10:51 AM, Marcel Loose <loose at astron.nl> wrote:

> Hi Denis,
>
> Kind of you to let me decide ;-)
>
> But seriously, I posted this question, because I wanted to know whether
> this is the CMake-way of doing things. Not because I like to write the
> macro that way.
>
> In the end, maybe a larger community might want to use this macro. If
> so, then it would really help if it adheres to some (unwritten)
> standards.


I suggest you avoid using COMPONENTS unless you're dealing with a package
which is broken up into several components at least one of which is
optional.  I agree with Denis and Adolfo that you should use a variable to
differentiate between the single and multithreaded versions of the library.

If you start using a list where you should be using a boolean, the end user
is just going to end up being confused.  You're also going to manufacture
additional error conditions that you'll have to handle in your code.

If for some reason your goal is concurrent searching for single and
multithreaded libraries so a user can use either in the same project (not
sure why anyone would want to do this but I don't even know what FFTW stands
for) you're far better off searching for both, i.e. FOO_ST_LIBRARY &
FOO_MT_LIBRARY and then choosing which gets set in FOO_LIBRARIES via a
boolean.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090520/85dcf633/attachment.htm>


More information about the CMake mailing list