On Saturday 10 March 2012, Alexander Neundorf wrote:
...
> What it does is it requires a lot of manual checking in the users
> CMakeLists.txt (because they have to check for each requested component
> individually).
> 
> How about
> 
> find_package(Foo COMPONENTS Bar Blub OPTIONAL_COMPONENTS Zot Zat ) ?
> 
> COMPONENTS: Foo_FOUND is only TRUE if all listed components have been found
> 
> OPTIONAL_COMPONENTS: they are not considered for setting Foo_FOUND
> 
> The result variables for each component will be fully ExactCase:
> Foo_Bar_FOUND etc.
> 
> The library and include dir variables from all listed and found components
> should be added to Foo_LIBRARIES and Foo_INCLUDE_DIRS.
> 
> If any components are given, it is recommended to search only the listed
> components. AFAICS only in corner cases bad things can happen if all
> components are searched.
> 
> How does that sound ?

I just had a look at how COMPONENTS is implemented in cmFindPackage.cxx:

   else if(doing == DoingComponents)
      {
      // Set a variable telling the find script this component
      // is required.
      std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i];
      this->AddFindDefinition(req_var.c_str(), "1");

      // Append to the list of required components.
      components += components_sep;
      components += args[i];
      components_sep = ";";
      }

Since this contains the word "required" multiple times this also suggests that 
the list of components is the list of required components.

IMO OPTIONAL_COMPONENTS looks like a good fit.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to