On 06/04/2011 06:30 AM, Alexander Neundorf wrote: > What do you think about adding this as a built-in feature to find_package(), > i.e. add a argument OPTIONAL to find_package(), then probably also a > "COMMENT".
The interface to find_package is already extensive. This feature would have to come with a whole bunch of other options to control the name of the variable to match project conventions, etc...and none of these has anything to do with actually finding the package. These features belong in project-specific macros, or simply option(USE_FOO "Enable features that require FOO") if(USE_FOO) find_package(FOO) endif() which IMO is more readable anyway. > 2) we have something similar for add_subdirectory(), > macro_optional_add_subdirectory(). > The purpose is to disable parts of a big project by skipping the > add_subdirectory. > > This is a wrapper around add_subdirectory(), but adds an option BUILD_FOO, > which is enabled by default. > If disabled, the actual add_subdirectory() is not executed. > Additionally there is an additional global option > DISABLE_ALL_OPTIONAL_SUBDIRECTORIES, which is disabled by default. > If enabled, all these optional subdirectories are disabled (but can be > enabled > again one by one). > > What do you think about adding the keyword OPTIONAL to add_subdirectory ? > > Both have been proven useful, the one for find_package() especially for > packagers. Ditto previous response. These commands are primitives. We should not extend them with features unrelated to their basic purpose. -Brad _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers