Re: [cmake-developers] find_package module-only policy
On 2/20/2012 1:06 PM, Alexander Neundorf wrote: On Monday 20 February 2012, Brad King wrote: ... (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they are used and the current minimum CMake version is not>= 2.8.8 so that people do not add them in places that will break old versions. Should it only warn if no mode keyword is used, or should it also warn if NO_MODULE is used ? Hmm...I think only if no mode keyword is used and no Find module is present. The NO_MODULE option is very old so I wouldn't warn about its use even thought after 2.8.8 it will be the same as CONFIG. The behaviour without keyword would stay unchanged, i.e. first Find-modules, the config files ? Yes through step (2) except for the messages being different after step (1). Step (3) adds a warning when there is no mode keyword and no Find module (and all the other conditions I stated). MODULE mode would be only Find-modules, no config files ? Yes. It would allow the error message to be very clear when no Find module exists. It is really only needed for symmetry and would not really be needed in practice except for debugging. I think that the first 2 steps along with proper documentation and PR may be enough. It provides all the tools projects need to produce unambiguous messages but does not force anything. We could also take the "CMAKE_FIND_PACKAGE_WARN_NO_MODULE" part of step 3 because it gives projects a choice. After that we get into less satisfactory changes but I'm not totally opposed to them. -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
Re: [cmake-developers] find_package module-only policy
On 2/20/2012 5:01 PM, Alexander Neundorf wrote: I don't have a strong opinion on this, but I'd prefer CONFIG_MODE over CONFIG for two reasons: * find_package_handle_standard_args() already knows the keyword CONFIG_MODE, so I wouldn't introduce a second similar but slightly different keyword to mean the same * CONFIG_MODE is more different from CONFIGS than CONFIG FPHSA is an internal implementation detail for Find modules. It is not part of a major API. I do have a strong opinion on this. The new find_package option will be called "CONFIG", please. There is now a branch FindPackage_ModeWarning on stage. It is branched away from the FindPackage_CONFIG_MODE_MODULE_MODE branch. - default mode is unchanged. - MODULE_MODE uses only the Find-modules - NO_MODULE == CONFIG_MODE uses only the config files. - warning messages are printed, but they are not finished, to say the least It warns if: * the required version is< 2.8.8, and MODULE_MODE or CONFIG_MODE has been used Good, except for s/_MODE//. * the required version is< 2.8.8, CMAKE_FIND_PACKAGE_WARN_NO_MODULE is TRUE, no Find-module has been found and NO_MODULE has not been used Good. * the required version is>= 2.8.8, no Find-module has been found, and no mode keyword has been used Is that what you meant ? Yes, thanks. > And I still think the error message as it is (in the branch), is correct, it > doesn't *create* any ambiguity. All it does is, it explains the actual > situation to the user. > The problem that it is unclear to the user (and to cmake) what is needed, is > already there, because due to the automatic fallback it actually is unclear > what is needed. IMO it is very clear to CMake what is needed. The documented equivalent to the new CONFIG mode keyword option has always been to NOT provide a Find module in the CMAKE_MODULE_PATH. It's really not that hard to put a Find module in your source tree and set CMAKE_MODULE_PATH to point at it. By NOT doing that one tells CMake to use Config mode. IMO if developers do crazy tricks with setting the CMAKE_MODULE_PATH to places outside their source tree then they should be on their own. 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. I think this doesn't change a lot compared to: [snip] They both say the same, just the order is different. The order is *everything*. In the case that the project is written correctly then your wording tells the user the *wrong* information by focusing on the Find module first. IMO that is one reason everyone thinks that every project needs a Find module instead of a package config file. Even when they set up a Config file the error message still asks for a Find module. My wording makes it clear what the user needs to do when the project is written correctly. Then as a convenience it adds a note that there might be a bug in the project. Either way the proper course of action is to look for the Config file. If it is discovered that the target package doesn't provide one then it is a bug in the project trying to find it. -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
Re: [cmake-developers] find_package module-only policy
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
Re: [cmake-developers] find_package module-only policy
On Tuesday 21 February 2012, Brad King wrote: > 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. Ok, new day, new branch ;-) This is now in the FindPackage_CONFIG_MODULEKeywordsFirst branch on stage, branched away from FindPackage_ImprovedErrorMessages. I haven't adjusted the default mode error message yet. The other error messages are quite close to what you show below. Also the new AUTHOR_WARNING text is not really very good yet. Documentation and test is also still missing. There is the potential issue with "CONFIG" and "MODULE" being in use as module names already somewhere. 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
Re: [cmake-developers] find_package module-only policy
On 2/21/2012 5:09 PM, Alexander Neundorf wrote: > This is now in the FindPackage_CONFIG_MODULEKeywordsFirst branch on stage, [snip] > There is the potential issue with "CONFIG" and "MODULE" being in use as > module > names already somewhere. Yes. I hadn't actually intended for you to go straight to implementation with that idea. I only intended it as a possibility for discussion. Your concern also makes me realize that find_package has always had the package name first. There are many other ways to imply CONFIG mode by using some of the full signature arguments. I think the original find_package(Foo CONFIG) ordering is better in light of these concerns. Thanks, -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
Re: [cmake-developers] find_package module-only policy
On 2/21/2012 4:22 PM, Alexander Neundorf wrote: > Problem ? > Somebody has a FindConfig.cmake here: > http://lists.gforge.inria.fr/pipermail/blobseer-commits/2009- > January/000101.html > > There may be also a FindCONFIG.cmake or a FindMODULE.cmake somewhere... > > Ignore and just hope it will be ok ? No, I think the package-name-first-always ordering is better. I hadn't thought of the case sensitivity concern before. Thanks, -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
Re: [cmake-developers] find_package module-only policy
On Wednesday 22 February 2012, Brad King wrote: > On 2/21/2012 5:09 PM, Alexander Neundorf wrote: > > This is now in the FindPackage_CONFIG_MODULEKeywordsFirst branch on > > stage, > > [snip] > > > There is the potential issue with "CONFIG" and "MODULE" being in use as > > module names already somewhere. > > Yes. I hadn't actually intended for you to go straight to > implementation with that idea. I only intended it as a > possibility for discussion. >From my side I had no need to discuss, I really like this idea. I mean, I really like this suggestion. Only problem is the FindCONFIG.cmake and FindMODULE.cmake case... If we can find a way how to avoid this problem I'd be all for this solution. Enabling the keywords MODULE and CONFIG only via a policy ? It could warn if the name of the package is one of the known keywords or looks like a version number. Not that nice, but maybe acceptable for those uncommon package names ? Or make the keyword more unique, i.e. longer ? find_package(CONFIG_MODE|MODULE_MODE Foo) Doesn't look that nice, but should be safe enough. Other ideas ? 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
Re: [cmake-developers] find_package module-only policy
On 2/22/2012 12:47 PM, Alexander Neundorf wrote: From my side I had no need to discuss, I really like this idea. I mean, I really like this suggestion. Only problem is the FindCONFIG.cmake and FindMODULE.cmake case... If we can find a way how to avoid this problem I'd be all for this solution. Enabling the keywords MODULE and CONFIG only via a policy ? I think that's too complicated for now. It is much simpler to just put the keywords at the same place as NO_MODULE currently goes. We can always add the mode-first signatures later. Thanks, -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
Re: [cmake-developers] find_package module-only policy
On Wednesday 22 February 2012, Brad King wrote: > On 2/22/2012 12:47 PM, Alexander Neundorf wrote: > > From my side I had no need to discuss, I really like this idea. > > > > I mean, I really like this suggestion. > > Only problem is the FindCONFIG.cmake and FindMODULE.cmake case... > > > > If we can find a way how to avoid this problem I'd be all for this > > solution. Enabling the keywords MODULE and CONFIG only via a policy ? > > I think that's too complicated for now. It is much simpler to just > put the keywords at the same place as NO_MODULE currently goes. Yes, probably. I will think a bit more about it... > We can always add the mode-first signatures later. I think if possible we should change it only once. 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
Re: [cmake-developers] find_package module-only policy
On 2/22/2012 4:30 PM, Alexander Neundorf wrote: On Wednesday 22 February 2012, Brad King wrote: I think that's too complicated for now. It is much simpler to just put the keywords at the same place as NO_MODULE currently goes. Yes, probably. I will think a bit more about it... Actually thinking more about the signature I like the package-first approach better even when the CONFIG or MODULE keyword is used. Let's not bike-shed this anymore. We're just adding more names like NO_MODULE. I'd rather focus on the error message wording which is more important. -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
Re: [cmake-developers] find_package module-only policy
On Wednesday 22 February 2012, Brad King wrote: > On 2/22/2012 4:30 PM, Alexander Neundorf wrote: > > On Wednesday 22 February 2012, Brad King wrote: > >> I think that's too complicated for now. It is much simpler to just > >> put the keywords at the same place as NO_MODULE currently goes. > > > > Yes, probably. I will think a bit more about it... > > Actually thinking more about the signature I like the package-first > approach better even when the CONFIG or MODULE keyword is used. Let's > not bike-shed this anymore. We're just adding more names like NO_MODULE. > > I'd rather focus on the error message wording which is more important. I updated the FindPackage_ModeWarning branch. It should now have everything as discussed here, please review. The FindPackageTest now also tries to list more or less all possible failure messages, the output is attached. Alex Listing find_package() error messages -- No keyword -- CMake Warning at CMakeLists.txt:313 (find_package): By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "NotHere", but CMake did not find one. Could not find a package configuration file provided by "NotHere" with any of the following names: NotHereConfig.cmake nothere-config.cmake Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set "NotHere_DIR" to a directory containing one of the above files. If "NotHere" provides a separate development package or SDK, be sure it has been installed. -- MODULE -- CMake Warning (dev) at CMakeLists.txt:315 (find_package): Keyword MODULE used in find_package(), but required CMake version 2.6 is less than 2.8.8. Consider using the NO_MODULE keyword instead. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning at CMakeLists.txt:315 (find_package): No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. CMake Warning (dev) at CMakeLists.txt:315 (find_package): FindNotHere.cmake must either be part of this project itself, in this case adjust CMAKE_MODULE_PATH so that it points to the correct location inside its source tree. Or it must be installed by a package which has already been found via find_package(). In this case make sure that package has indeed been found and adjust CMAKE_MODULE_PATH to contain the location where that package has installed FindNotHere.cmake. This must be a location provided by that package. This error in general means that the buildsystem of this project is relying on a Find-module without ensuring that it is actually available. This warning is for project developers. Use -Wno-dev to suppress it. -- NO_MODULE --- CMake Warning at CMakeLists.txt:317 (find_package): Could not find a package configuration file provided by "NotHere" with any of the following names: NotHereConfig.cmake nothere-config.cmake Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set "NotHere_DIR" to a directory containing one of the above files. If "NotHere" provides a separate development package or SDK, be sure it has been installed. -- CONFIG -- CMake Warning (dev) at CMakeLists.txt:319 (find_package): Keyword CONFIG used in find_package(), but required CMake version 2.6 is less than 2.8.8. Consider using the NO_MODULE keyword instead. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning at CMakeLists.txt:319 (find_package): Could not find a package configuration file provided by "NotHere" with any of the following names: NotHereConfig.cmake nothere-config.cmake Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set "NotHere_DIR" to a directory containing one of the above files. If "NotHere" provides a separate development package or SDK, be sure it has been installed. -- 1 name -- CMake Warning (dev) at CMakeLists.txt:321 (find_package): Keyword CONFIG used in find_package(), but required CMake version 2.6 is less than 2.8.8. Consider using the NO_MODULE keyword instead. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning at CMakeLists.txt:321 (find_package): Could not find a package configuration file named "NotHereWithOneName.cmake" provided by package "NotHere". Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set "NotHere_DIR" to a directory containing one of the above files. If "NotHere" provides a separate development package or SDK, be sure it has been installed. -- No keyword, version-- CMake Warning at CMakeLists.txt:324 (find_package): By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project h
Re: [cmake-developers] find_package module-only policy
On 2/25/2012 5:39 AM, Alexander Neundorf wrote: I updated the FindPackage_ModeWarning branch. It should now have everything as discussed here, please review. Nice. The MODULE keyword warning suggests using NO_MODULE which does not make sense (but it does for CONFIG of course). Perhaps for MODULE it can just warn about the min required version. I'll perform a more detailed review after that is fixed. The FindPackageTest now also tries to list more or less all possible failure messages, the output is attached. Thanks, that is good for manual reference. Eventually I'd like to see a real test that verifies the output for each case. I think the Tests/CMakeOnly directory is a good place along with the PASS/FAIL_REGULAR_EXPRESSION test properties. We can look at adding such tests separately after the main topic is done. Thanks, -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
Re: [cmake-developers] find_package module-only policy
On Monday 27 February 2012, Brad King wrote: > On 2/25/2012 5:39 AM, Alexander Neundorf wrote: > > I updated the FindPackage_ModeWarning branch. > > It should now have everything as discussed here, please review. > > Nice. > > The MODULE keyword warning suggests using NO_MODULE which does not > make sense (but it does for CONFIG of course). Perhaps for MODULE > it can just warn about the min required version. This is already fixed in the branch which is on stage. > I'll perform a more detailed review after that is fixed. > > > The FindPackageTest now also tries to list more or less all possible > > failure messages, the output is attached. > > Thanks, that is good for manual reference. Eventually I'd like > to see a real test that verifies the output for each case. I What would you want to test ? The wording of the error messages ? 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
Re: [cmake-developers] find_package module-only policy
On 2/27/2012 11:49 AM, Alexander Neundorf wrote: On Monday 27 February 2012, Brad King wrote: The MODULE keyword warning suggests using NO_MODULE which does not make sense (but it does for CONFIG of course). Perhaps for MODULE it can just warn about the min required version. This is already fixed in the branch which is on stage. Thanks. Thanks, that is good for manual reference. Eventually I'd like to see a real test that verifies the output for each case. I What would you want to test ? The wording of the error messages ? Yes, and for all cases. If the wording changes the test should fail unless it is also updated. That way we cannot introduce wording changes accidentally. This is a concern because much of the wording is generated in pieces by various conditions. -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
Re: [cmake-developers] find_package module-only policy
On Monday 27 February 2012, Brad King wrote: > On 2/27/2012 11:49 AM, Alexander Neundorf wrote: > > On Monday 27 February 2012, Brad King wrote: > >> The MODULE keyword warning suggests using NO_MODULE which does not > >> make sense (but it does for CONFIG of course). Perhaps for MODULE > >> it can just warn about the min required version. > > > > This is already fixed in the branch which is on stage. > > Thanks. Anything left I should do before merging into next ? The documentation of find_package() may need some modifications, I thought you may want to have a look at that ? 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
Re: [cmake-developers] find_package module-only policy
On 2/27/2012 3:17 PM, Alexander Neundorf wrote: Anything left I should do before merging into next ? The documentation of find_package() may need some modifications, I thought you may want to have a look at that ? I reverted FindPackage_ImprovedErrorMessages from next and replaced it with find_package-report-CONFIGS-error containing only the bugfix. I also removed the topics FindPackage_CONFIG_MODE_MODULE_MODE FindPackage_CONFIG_MODULEKeywordsFirst FindPackage_ImprovedErrorMessages FindPackage_MODULE_MODE_Policy from the stage (I have backups locally). This makes room for the new changes we've discussed in this thread without mixing them up with the original proposal. I replaced the FindPackage_ModeWarning topic on the stage with a rewritten one that makes (almost) the same net change. I just tweaked the documentation of find_package a bit and wrapped a couple long lines in the source code. The new sequence of commits makes each part of the change much clearer and easier to review. However, I'm not yet prepared to merge this to next. I'm going to make more significant edits to the proposed changes and post them as a separate topic and then report back here. -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
Re: [cmake-developers] find_package module-only policy
On 2/28/2012 8:24 AM, Brad King wrote: I replaced the FindPackage_ModeWarning topic on the stage with a [snip] However, I'm not yet prepared to merge this to next. I'm going to make more significant edits to the proposed changes and post them as a separate topic and then report back here. I pushed new topic find_package-improve-messages that shares the beginning of FindPackage_ModeWarning but then makes slightly different changes: - I improved detection of options that conflict with MODULE. CONFIG and NO_MODULE are not the only conflicts. Other options imply Config mode too. - I added a test to check the major failure case message text by actually comparing it to known output. This is a stronger test than your FindPackageTest change and provides a reference for the message text of each case right in the source tree without running anything. - I decided to drop the warning for MODULE or CONFIG keywords without a sufficiently high minimum required CMake version. We don't warn for other commands that have new options, and the project could guard the use with its own test of the CMake version without actually bumping the min req version e.g. "if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.8)". We should not warn in such cases. - I changed the warning text and documentation text of the CMAKE_FIND_PACKAGE_WARN_NO_MODULE variable to change the tone from "less ambiguous" to "more specific." - I really don't want to ever warn in the default mode when falling back to Config mode. I think the new failure message text and explicit mode keywords are sufficient to solve this problem. Therefore CMAKE_FIND_PACKAGE_WARN_NO_MODULE will be required to get the warning and 2.8.8 will not warn by default. IMO this topic is ready to be merged to 'next' for testing. -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
Re: [cmake-developers] find_package module-only policy
On Tuesday 28 February 2012, Brad King wrote: > On 2/28/2012 8:24 AM, Brad King wrote: > > I replaced the FindPackage_ModeWarning topic on the stage with a > > [snip] > > > However, I'm not yet prepared to merge this to next. I'm going > > to make more significant edits to the proposed changes and post > > them as a separate topic and then report back here. > > I pushed new topic > >find_package-improve-messages > > that shares the beginning of FindPackage_ModeWarning but then > makes slightly different changes: > > - I improved detection of options that conflict with MODULE. > CONFIG and NO_MODULE are not the only conflicts. Other options > imply Config mode too. > > - I added a test to check the major failure case message text > by actually comparing it to known output. This is a stronger > test than your FindPackageTest change and provides a reference > for the message text of each case right in the source tree > without running anything. > > - I decided to drop the warning for MODULE or CONFIG keywords > without a sufficiently high minimum required CMake version. > We don't warn for other commands that have new options, and > the project could guard the use with its own test of the > CMake version without actually bumping the min req version > e.g. "if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.8)". We should > not warn in such cases. > > - I changed the warning text and documentation text of the > CMAKE_FIND_PACKAGE_WARN_NO_MODULE variable to change the tone > from "less ambiguous" to "more specific." > > - I really don't want to ever warn in the default mode when > falling back to Config mode. I think the new failure message > text and explicit mode keywords are sufficient to solve this > problem. Therefore CMAKE_FIND_PACKAGE_WARN_NO_MODULE will be > required to get the warning and 2.8.8 will not warn by default. I would prefer to warn, but it's ok. > IMO this topic is ready to be merged to 'next' for testing. Fine with me :-) I'll delete my various findpackage-branches from stage then ? Thanks 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
Re: [cmake-developers] find_package module-only policy
On 2/28/2012 3:02 PM, Alexander Neundorf wrote: On Tuesday 28 February 2012, Brad King wrote: IMO this topic is ready to be merged to 'next' for testing. Fine with me :-) I've now merged it :) I'll delete my various findpackage-branches from stage then ? In an earlier message I reported that I deleted most of them. I just now deleted FindPackage_ModeWarning as well. I have backups of all of the topics just in case. -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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On 2/17/2012 1:54 PM, Alexander Neundorf wrote: Should I do this by continuing in the FindPackage_ImprovedErrorMessages branch or create a new branch, branched away from FindPackage_ImprovedErrorMessages ? The messages will probably be all different with the policy. Let's start a new one for this change and revert the current branch to avoid conflicts. Thanks, -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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On 2/18/2012 10:43 AM, Alexander Neundorf wrote: > This is now in the branch FindPackage_MODULE_MODE_Policy on stage. > I still have to add tests. Thanks for the prototype. I'm not promising acceptance yet but it is a good reference for discussion. I'm going to continue the discussion over on Stephen's response in this thread. > I think with this new policy MODULE_MODE should not be considered the "simple > signature" and NO_MODULE the "full signature" anymore, but both with equal > rights. It used to be one signature but IIRC you asked me to break out the reduced signature since that is all people need most of the time. After thinking about the new _MODE options more I think calling them just "MODULE" and "CONFIG" is better. The former is very clearly the opposite of NO_MODULE, and the latter reads well: find_package(Foo CONFIG) # find Foo's package "config" file I do not think the similarity of "CONFIG" to the existing "CONFIGS" is a problem because the latter implies the former anyway so they never need to be used at the same time. The latter reads well too: find_package(Foo CONFIGS FooConfig.cmake) # (Finds "FooConfig.cmake" from package Foo) # ("CONFIGS" is similar to "NAMES" in find_library) -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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On Sunday 19 February 2012, Brad King wrote: > On 2/18/2012 10:43 AM, Alexander Neundorf wrote: > > This is now in the branch FindPackage_MODULE_MODE_Policy on stage. > > I still have to add tests. > > Thanks for the prototype. I'm not promising acceptance yet > but it is a good reference for discussion. I'm going to > continue the discussion over on Stephen's response in this > thread. > > > I think with this new policy MODULE_MODE should not be considered the > > "simple signature" and NO_MODULE the "full signature" anymore, but both > > with equal rights. > > It used to be one signature but IIRC you asked me to break out the > reduced signature since that is all people need most of the time. > > After thinking about the new _MODE options more I think calling > them just "MODULE" and "CONFIG" is better. Fine with me. 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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On 2/19/2012 10:54 AM, Alexander Neundorf wrote: I don't see a problem with needing an additional keyword. find_package(Qt5) vs. find_package(Qt5 CONFIG_MODE) Remember we decided on find_package(Qt5 CONFIG) instead which reads better. I'm not opposed outright to this syntax in the future. However, I think the policy as proposed is too aggressive for transition. It will create a warning on every config-mode find_package call that exists in any project release to date. This penalizes everyone who was proactive enough to have read, understood, and used the more powerful config-mode. The warning will remain in all the old releases of their projects forever and make it look like they did something wrong. Furthermore, to avoid the warning in new versions they will have to add extra decoration to their calls, and during the transition period that decoration will be spelled NO_MODULE which is pretty ugly when not in a Find module. -- We need a smoother transition plan. It must not create warnings in old projects. Here is a plan I can accept: (1) Improve the current ambiguous error message (see below). (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they are used and the current minimum CMake version is not >= 2.8.8 so that people do not add them in places that will break old versions. (3) Add two possible AUTHOR_WARNING messages in the case that no mode keyword or Find module is present: - If the current minimum CMake required version is >= 2.8.8 then warn that MODULE or CONFIG should be used. - Otherwise if CMAKE_FIND_PACKAGE_WARN_NO_MODULE is set to true then warn that NO_MODULE should be used to get the config mode. The first one will not appear in old projects but will become more common over time. The second one can be used in projects (KDE) to get the warning even before bumping the min required version to 2.8.8. In either case the warning should appear even when the package configuration file is found. This will convince developers to add the keyword because it is required to avoid the warning. (4) In the future, e.g. CMake 3.0.0, add the policy if necessary. At that point it will be able to leverage the new features added above so that the NEW behavior is clean. -- Now to improve the error message (step 1 above). The current ambiguous error message originated here: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53d9d84f Prior to that it only talked about the package config file. It was only in an attempt to help developers debug their CMAKE_MODULE_PATH that the ambiguous message was added, but at the cost of making it unclear to users what is needed. The message needs to be clear to users and developers, but with a preference for users because it will appear even in properly written projects when the package config file is not found. We can extend what I previously proposed: CMake Error at CMakeLists.txt:7 (find_package): No package configuration file for "ecm" found by 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. If "ecm" does not provide a package configuration file then this project must ensure that a Findecm.cmake module lies in its CMAKE_MODULE_PATH before calling find_package. The last paragraph should not appear with NO_MODULE or CONFIG. If no Find module is available but MODULE was used then one can write a very detailed message about setting CMAKE_MODULE_PATH. The future policy in step 4 above can make this the default in its NEW behavior. -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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
Brad King wrote: > On 2/19/2012 10:54 AM, Alexander Neundorf wrote: >> I don't see a problem with needing an additional keyword. >> >> find_package(Qt5) >> vs. >> find_package(Qt5 CONFIG_MODE) > > Remember we decided on > >find_package(Qt5 CONFIG) > > instead which reads better. > > I'm not opposed outright to this syntax in the future. However, I > think the policy as proposed is too aggressive for transition. It > will create a warning on every config-mode find_package call that > exists in any project release to date. This penalizes everyone who > was proactive enough to have read, understood, and used the more > powerful config-mode. The warning will remain in all the old releases > of their projects forever and make it look like they did something > wrong. Furthermore, to avoid the warning in new versions they will > have to add extra decoration to their calls, and during the transition > period that decoration will be spelled NO_MODULE which is pretty ugly > when not in a Find module. The discussion on the KDE buildsystem list to addresses some deeper frustrations with the way CMake finds packages, including modifying the cache through CMake-gui where to find things in the case that Find modules are used: http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/7065/focus=7124 Could be useful for your consideration. Thanks, Steve. -- 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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On Monday 20 February 2012, Brad King wrote: ... > (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they > are used and the current minimum CMake version is not >= 2.8.8 so that > people do not add them in places that will break old versions. Should it only warn if no mode keyword is used, or should it also warn if NO_MODULE is used ? The behaviour without keyword would stay unchanged, i.e. first Find-modules, the config files ? MODULE mode would be only Find-modules, no config files ? 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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On Monday 20 February 2012, Brad King wrote: > On 2/19/2012 10:54 AM, Alexander Neundorf wrote: > > I don't see a problem with needing an additional keyword. > > > > find_package(Qt5) > > vs. > > find_package(Qt5 CONFIG_MODE) > > Remember we decided on > >find_package(Qt5 CONFIG) > > instead which reads better. I don't have a strong opinion on this, but I'd prefer CONFIG_MODE over CONFIG for two reasons: * find_package_handle_standard_args() already knows the keyword CONFIG_MODE, so I wouldn't introduce a second similar but slightly different keyword to mean the same * CONFIG_MODE is more different from CONFIGS than CONFIG > I'm not opposed outright to this syntax in the future. However, I > think the policy as proposed is too aggressive for transition. It > will create a warning on every config-mode find_package call that > exists in any project release to date. This penalizes everyone who > was proactive enough to have read, understood, and used the more > powerful config-mode. The warning will remain in all the old releases > of their projects forever and make it look like they did something > wrong. Furthermore, to avoid the warning in new versions they will > have to add extra decoration to their calls, and during the transition > period that decoration will be spelled NO_MODULE which is pretty ugly > when not in a Find module. > > -- > > We need a smoother transition plan. It must not create warnings > in old projects. Here is a plan I can accept: > > (1) Improve the current ambiguous error message (see below). I don't think the modified message changes anything significantly (see below). > (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they > are used and the current minimum CMake version is not >= 2.8.8 so that > people do not add them in places that will break old versions. > > (3) Add two possible AUTHOR_WARNING messages in the case that no mode > keyword or Find module is present: > > - If the current minimum CMake required version is >= 2.8.8 then > warn that MODULE or CONFIG should be used. > > - Otherwise if CMAKE_FIND_PACKAGE_WARN_NO_MODULE is set to true then > warn that NO_MODULE should be used to get the config mode. There is now a branch FindPackage_ModeWarning on stage. It is branched away from the FindPackage_CONFIG_MODE_MODULE_MODE branch. - default mode is unchanged. - MODULE_MODE uses only the Find-modules - NO_MODULE == CONFIG_MODE uses only the config files. - warning messages are printed, but they are not finished, to say the least It warns if: * the required version is < 2.8.8, and MODULE_MODE or CONFIG_MODE has been used * the required version is < 2.8.8, CMAKE_FIND_PACKAGE_WARN_NO_MODULE is TRUE, no Find-module has been found and NO_MODULE has not been used * the required version is >= 2.8.8, no Find-module has been found, and no mode keyword has been used Is that what you meant ? > The first one will not appear in old projects but will become more > common over time. The second one can be used in projects (KDE) to get > the warning even before bumping the min required version to 2.8.8. > > In either case the warning should appear even when the package > configuration file is found. This will convince developers to > add the keyword because it is required to avoid the warning. > > (4) In the future, e.g. CMake 3.0.0, add the policy if necessary. At > that point it will be able to leverage the new features added above so > that the NEW behavior is clean. If there is always a warning when no mode keyword is used, I think this may not be necessary. > -- > > Now to improve the error message (step 1 above). The current > ambiguous error message originated here: > >http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53d9d84f > > Prior to that it only talked about the package config file. It was > only in an attempt to help developers debug their CMAKE_MODULE_PATH > that the ambiguous message was added, but at the cost of making it > unclear to users what is needed. Ok, so I added the message :-) And I still think the error message as it is (in the branch), is correct, it doesn't *create* any ambiguity. All it does is, it explains the actual situation to the user. The problem that it is unclear to the user (and to cmake) what is needed, is already there, because due to the automatic fallback it actually is unclear what is needed. > The message needs to be clear to users and developers, but with a > preference for users because it will appear even in properly written > projects when the package config file is not found. > > We can extend what I previously proposed: > > CMake Error at CMakeLists.txt:7 (find_package): > No package configuration file for "ecm" found by names: > > ecmConfig.cmake > ecm-config.cmake > > Add the installation pref
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On Monday 20 February 2012, Alexander Neundorf wrote: > On Monday 20 February 2012, Brad King wrote: ... > > (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they > > are used and the current minimum CMake version is not >= 2.8.8 so that > > people do not add them in places that will break old versions. > > > > (3) Add two possible AUTHOR_WARNING messages in the case that no mode > > > > keyword or Find module is present: > > - If the current minimum CMake required version is >= 2.8.8 then > > > > warn that MODULE or CONFIG should be used. > > > > - Otherwise if CMAKE_FIND_PACKAGE_WARN_NO_MODULE is set to true then > > > > warn that NO_MODULE should be used to get the config mode. > > There is now a branch FindPackage_ModeWarning on stage. I should have probably pushed all my commits to this branch... Done now. Working on your suggestions. 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
Re: [cmake-developers] find_package module-only policy (was: find_package error wording)
On Tuesday 21 February 2012, Alexander Neundorf wrote: > On Monday 20 February 2012, Alexander Neundorf wrote: > > On Monday 20 February 2012, Brad King wrote: > ... > > > > (2) Add the explicit MODULE and CONFIG mode keywords. Warn if they > > > are used and the current minimum CMake version is not >= 2.8.8 so that > > > people do not add them in places that will break old versions. > > > > > > (3) Add two possible AUTHOR_WARNING messages in the case that no mode > > > > > > keyword or Find module is present: > > > - If the current minimum CMake required version is >= 2.8.8 then > > > > > > warn that MODULE or CONFIG should be used. > > > > > > - Otherwise if CMAKE_FIND_PACKAGE_WARN_NO_MODULE is set to true then > > > > > > warn that NO_MODULE should be used to get the config mode. > > > > There is now a branch FindPackage_ModeWarning on stage. > > I should have probably pushed all my commits to this branch... > Done now. > > Working on your suggestions. Problem ? Somebody has a FindConfig.cmake here: http://lists.gforge.inria.fr/pipermail/blobseer-commits/2009- January/000101.html There may be also a FindCONFIG.cmake or a FindMODULE.cmake somewhere... Even so with FindConfig.cmake, if this runs on Windows, they might be doing find_package(CONFIG REQUIRED) Now it searches for the required package FindCONFIG.cmake. Then it would search for REQUIREDConfig.cmake... Using the next argument only as package name if it is not a known keyword or version number would lead to even more non-working package names: HINTS, PATHS, CONFIGS, "123", REQUIRED, COMPONENTS, NAMES (I left all keywords which have an underscore out, it is probably too unlikely that there is a FindPATH_SUFFIXES.cmake). Ignore and just hope it will be ok ? 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