[CMake] Apply FIND_PACKAGE_HANDLE_STANDARD_ARGS() on COMPONENTS
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Apr 21 15:13:10 EDT 2010
On Tuesday 20 April 2010, Michael Hertling wrote:
> Dear CMake community, dear CMake developers,
>
...
> There's another aspect related to this I'd like to comment on: During
> the abovementioned considerations on the bug tracker and the mailing
> list, the question has arisen if it's reasonable to set XXX_FOUND to
> FALSE if any of the requested components aren't found. As for myself,
> I'd say: No, it isn't. Let's have a look at the following scenario:
>
> Package XXX normally provides components YY1 and YY2, but for some
> reason, only YY1 is installed. Moreover, XXX provides a config file
> XXXConfig.cmake. Now, a project's CMake script requests both YY1/2 by
> FIND_PACKAGE(XXX COMPONENTS YY1 YY2). As Brad King has pointed out in
> <http://www.mail-archive.com/cmake@cmake.org/msg15952.html>, finding a
> config file results in XXX_FOUND to be set to TRUE automatically. Thus,
> the absence of YY2 does not mean the absence of XXX as a whole in any
> case, and, notwithstanding, the requesting CMake script should have a
> chance to proceed even if YY2 isn't available, i.e. the following seems
> reasonable: XXX_YY1_FOUND=TRUE, XXX_YY2_FOUND=FALSE *but* XXX_FOUND=TRUE.
I think I don't agree here.
If I say
find_package(XXX COMPONENTS YY1 YY2 REQUIRED)
I think it makes a lot of sense to interpret this as "search package XXX, and
I need YY1 and YY2 from it".
What other reason would I have to give YY1 and YY2 there otherwise ?
If it still succeeds if they are not found, why should I list them then ?
I think by default (no COMPONENTS specified) all components should be
searched. By listing components you can say "I am ok if at least these are
found". (the man page doesn't say anything about how the "COMPONENTS" should
be interpreted).
Alex
More information about the CMake
mailing list