On 2/20/2012 5:43 PM, Brad King wrote:
The new find_package option will be called "CONFIG", please.
Another possibility is to require the mode keywords to come as the first argument, before the package name, just like many other commands: find_package(CONFIG Foo) That will clearly distinguish it from other options that affect the settings within Config mode.
I'm still not happy about warning without a CONFIG or NO_MODULE keyword. I think the message wording can be made good enough to solve this problem, especially when the new CONFIG and MODULE keywords can be used *optionally* to get even better messages.
Let's focus first on the wording of the current message and see what we can get since it's needed either way and we can always take step (3) later. Here is another idea for the message wording for the default mode when no Find module is present. It explains exactly why CMake is looking for a package configuration file and who is expected to provide what: CMake Error at CMakeLists.txt:7 (find_package): By not providing "Findecm.cmake" in CMAKE_MODULE_PATH the caller has asked CMake to find a package configuration file provided by "ecm", but CMake did not find one. Could not find a package configuration file provided by "ecm" with any of the names: ecmConfig.cmake ecm-config.cmake Add the installation prefix of "ecm" to CMAKE_PREFIX_PATH or set "ecm_DIR" to a directory containing one of the above files. If "ecm" provides separate development package or SDK be sure it has been installed. The first paragraph explains how CMake is interpreting the intention of the caller. This puts the blame or credit at the call site in the project code where it belongs both when it is a bug and when it is intentional. It can be dropped in explicit CONFIG mode: CMake Error at CMakeLists.txt:7 (find_package): Could not find a package configuration file provided by "ecm" with any of the names: ecmConfig.cmake ecm-config.cmake Add the installation prefix of "ecm" to CMAKE_PREFIX_PATH or set "ecm_DIR" to a directory containing one of the above files. If "ecm" provides separate development package or SDK be sure it has been installed. In explicit MODULE mode the message can leave out the package config file text altogether (we can add more detail too): CMake Error at CMakeLists.txt:7 (find_package): No "Findecm.cmake" module is present in CMAKE_MODULE_PATH. -Brad -- 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