2011/6/4 Alexander Neundorf <neund...@kde.org>: > Hi, > > again from the KDE sprint... > > 1) We have a macro > macro_optional_find_package(). > The purpose is to be able to build without a specific package even if that > package is installed and would actually be found by the find_package() call. > > Basically this is a wrapper around find_package(), but additionally it adds an > option WITH_Foo, which is enabled by default. > If disabled, the actual find_package() is not executed, and the variables > FOO_FOUND/INCLUDES/LIBRARIES are reset to empty, so that even if the package > hasn't been searched this time, results from previous runs are discarded. > > 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".
I'm not sure about this feature and since we already have REQUIRED why would be the meaning of OPTIONAL? May be some syntax like find_package(Foo IF <VarName>) would be clearer. find_package(Foo IF BUILD_WITH_Foo) would create option BUILD_WITH_Foo (default value would the value of BUILD_WITH_Foo_Default var or ON if it is not defined) and the search of the package will be done iff the option is ON. > 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 ? Same remark may IF keyword with the option name as argument would be better. > Both have been proven useful, the one for find_package() especially for > packagers. Agreed, the feature is nice I use similar thing with hand-crafted option in some project. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers