Re: [cmake-developers] Setting ExactCase_FOUND in FPHSA
On 02/19/2013 02:45 PM, Alexander Neundorf wrote: On Monday 18 February 2013, Brad King wrote: Why not also pass in the name of the _FOUND variable e.g. FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Foo_FOUND) I agree with this, OTOH the maintainer could now write # copy'n paste error ? FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Bar_FOUND) # typo ? FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR foop_FOUND) which bypasses the effect of consistent naming of the _FOUND variable. This would not be the case with an option USE_EXACT_CASE or something similar. Imagine reading FindFoo.cmake without being aware of FPHSA and its role, as a user of such a module might do. The docs say it sets Foo_FOUND but I do not see that name anywhere in the implementation. I ask myself Where is it set?. Seeing the call: FPHSA(Foo USE_ORIGINAL_CASE REQUIRED_VARS FOO_INCLUDE_DIR FOO_LIBRARY) I would have no idea what USE_ORIGINAL_CASE affects. OTOH the call FPHSA(Foo FOUND_VAR Foo_FOUND REQUIRED_VARS FOO_INCLUDE_DIR FOO_LIBRARY) is pretty clear that it does something related to the Foo_FOUND mentioned in the documentation. Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or PACKAGENAME_FOUND, but this would be somewhat strange. IMO that would be better. It's not much different from a C++ interface that accepts a named enumeration value instead of an int. -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] Setting ExactCase_FOUND in FPHSA
On Thursday 21 February 2013, Brad King wrote: On 02/19/2013 02:45 PM, Alexander Neundorf wrote: ... Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or PACKAGENAME_FOUND, but this would be somewhat strange. IMO that would be better. It's not much different from a C++ interface that accepts a named enumeration value instead of an int. I can do that too if you don't think it's weird. So, really ? 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] Setting ExactCase_FOUND in FPHSA
On 02/21/2013 12:36 PM, Alexander Neundorf wrote: On Thursday 21 February 2013, Brad King wrote: On 02/19/2013 02:45 PM, Alexander Neundorf wrote: ... Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or PACKAGENAME_FOUND, but this would be somewhat strange. IMO that would be better. It's not much different from a C++ interface that accepts a named enumeration value instead of an int. I can do that too if you don't think it's weird. So, really ? Yes, please. -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] Setting ExactCase_FOUND in FPHSA
On Thursday 21 February 2013, Brad King wrote: On 02/21/2013 12:36 PM, Alexander Neundorf wrote: On Thursday 21 February 2013, Brad King wrote: On 02/19/2013 02:45 PM, Alexander Neundorf wrote: ... Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or PACKAGENAME_FOUND, but this would be somewhat strange. IMO that would be better. It's not much different from a C++ interface that accepts a named enumeration value instead of an int. I can do that too if you don't think it's weird. So, really ? Yes, please. Done, I merged FPHSA_FOUND_VAR_OPTION into next. 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] Setting ExactCase_FOUND in FPHSA
On 02/21/2013 03:52 PM, Alexander Neundorf wrote: Done, I merged FPHSA_FOUND_VAR_OPTION into next. Great, 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] Setting ExactCase_FOUND in FPHSA
On Friday 15 February 2013, Alexander Neundorf wrote: On Friday 15 February 2013, Stephen Kelly wrote: Hi, FindPackageHandleStandardArgs sets an uppercase found variable, but not an ExactCase_FOUND variable. This is inconsistent with how config files work. It also imposes on users the necessity that their FOUND variable is uppercase. how about adding an option EXACTCASE, which modules which use ExactCase can use, and so only one of the two variables is set ? This is now in next in the FPHSA_USE_ORIGINAL_CASE branch. The name of the option is USE_ORIGINAL_CASE. 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] Setting ExactCase_FOUND in FPHSA
On Monday 18 February 2013, Brad King wrote: On 02/18/2013 04:52 PM, Stephen Kelly wrote: Anyway, I don't agree with your conclusion, but I guess Brad gets the casting vote of doing nothing or not. I understand your position and you understand mine I'm sure. All that's needed is to decide :). One thing that has always bothered me about FPHSA is that modules using it have no mention of a _FOUND variable in the call to it. It is just magically set under the hood. A module author needs to read FPHSA docs to know what _FOUND variable will be set. well, it's more or less the main purpose of FPHSA to set the _FOUND variable, and handle the options (REQUIRED, QUIET, versions) consistently for all Find- modules which use it. OTOH we already pass pkg_INCLUDE_DIR, pkg_LIBRARY, and other pkg_ variables to FPHSA: FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY) so that it can check if everything is found. Why not also pass in the name of the _FOUND variable e.g. FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Foo_FOUND) ? Then it is clear when reading the call site what the _FOUND variable is called. It also makes it clearer when reading the module when _FOUND is set. I agree with this, OTOH the maintainer could now write # copy'n paste error ? FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Bar_FOUND) # typo ? FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR foop_FOUND) which bypasses the effect of consistent naming of the _FOUND variable. This would not be the case with an option USE_EXACT_CASE or something similar. Well, FPHSA could error out if FOUND_VAR does not equal PackageName_FOUND or PACKAGENAME_FOUND, but this would be somewhat strange. 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] Setting ExactCase_FOUND in FPHSA
On Monday 18 February 2013, Stephen Kelly wrote: Alexander Neundorf wrote: I mean, even if FPHSA would set ExactCase_FOUND always by default, there still would be no guarantee at all that after a find_package(Foo) Foo_FOUND will be set, because as a user of that module I don't know whether it uses FPHSA or not. I have to read the documentation. If you want to set the text on a text-related Qt widget, there's no guarantee that the method you want is setText. It usually deliberately is, but you have to read the documentation to be sure :). Anyway, I don't agree with your conclusion, I don't see where automatically setting ExactCase_FOUND improves over the current situation. Right now, as a user of a Find-module you can only rely on the variables as documented for each Find-module. With automatic setting, you still can only rely on the documented variables, since it is only a (to the user unknown) subset of Find-modules which additionally sets the undocumented ExactCase_FOUND variable. Would find_package(BZip2) set BZip2_FOUND with the patch ? Nobody can know without looking at the code of FindBZip2.cmake 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] Setting ExactCase_FOUND in FPHSA
On 2013-02-19 15:09, Alexander Neundorf wrote: I don't see where automatically setting ExactCase_FOUND improves over the current situation. Right now, as a user of a Find-module you can only rely on the variables as documented for each Find-module. This sounds like a bug. Why not just fix those find modules not using FPHSA? Then you could document in find_package() that ExactCase_FOUND is set if the package is found. (And consider deprecating UpperCase_FOUND.) -- Matthew -- 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] Setting ExactCase_FOUND in FPHSA
On 02/19/2013 03:54 PM, Matthew Woehlke wrote: This sounds like a bug. Why not just fix those find modules not using FPHSA? Then you could document in find_package() that ExactCase_FOUND is set if the package is found. (And consider deprecating UpperCase_FOUND.) Many find modules are distributed outside of CMake. We cannot control all of them. Therefore find_package cannot guarantee anything in module mode. The _FOUND variable is not the only one that one must read docs before using. All other output variables like _LIBRARIES, _LIBRARY_DIRS, _INCLUDE_DIRS, etc. may have varied names. -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] Setting ExactCase_FOUND in FPHSA
On Tuesday 19 February 2013, Matthew Woehlke wrote: On 2013-02-19 15:09, Alexander Neundorf wrote: I don't see where automatically setting ExactCase_FOUND improves over the current situation. Right now, as a user of a Find-module you can only rely on the variables as documented for each Find-module. This sounds like a bug. No, this is no bug. There is nothing else a Find-module could comply to, than its own documentation. The readme.txt installed along with the Find-module is for authors of Find- modules, not visible for users of Find-modules. It also only contains recommendations (should, try, please, would like). You can write a Find-module in whatever way you like, and as long as it respects the given arguments (REQUIRED, QUIET, version) and behaves as documented, it is not buggy. 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] Setting ExactCase_FOUND in FPHSA
On 2013-02-19 16:21, Alexander Neundorf wrote: On Tuesday 19 February 2013, Matthew Woehlke wrote: On 2013-02-19 15:09, Alexander Neundorf wrote: I don't see where automatically setting ExactCase_FOUND improves over the current situation. Right now, as a user of a Find-module you can only rely on the variables as documented for each Find-module. This sounds like a bug. No, this is no bug. There is nothing else a Find-module could comply to, than its own documentation. Right. That sounds like a bug (or design flaw, if you prefer). At least, it doesn't strike me as something that can't be improved. What is the problem defining an expected behavior, and then pushing find modules towards conforming to that? -- Matthew -- 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] Setting ExactCase_FOUND in FPHSA
On Tuesday 19 February 2013, Matthew Woehlke wrote: On 2013-02-19 16:21, Alexander Neundorf wrote: On Tuesday 19 February 2013, Matthew Woehlke wrote: On 2013-02-19 15:09, Alexander Neundorf wrote: I don't see where automatically setting ExactCase_FOUND improves over the current situation. Right now, as a user of a Find-module you can only rely on the variables as documented for each Find-module. This sounds like a bug. No, this is no bug. There is nothing else a Find-module could comply to, than its own documentation. Right. That sounds like a bug (or design flaw, if you prefer). At least, it doesn't strike me as something that can't be improved. What is the problem defining an expected behavior, and then pushing find modules towards conforming to that? this is already the case, that's the purpose of the readme.txt which exists since a long time, and this is the purpose of FPHSA, which I added I think in 2007. But there is nothing that enforces those conventions. Users have to read the documentation, and hopefully as many Find-modules as possible follow the guidelines. But since nothing *guarantees* that any arbitrary Find-module uses FPHSA, and more concrete the FPHSA coming with cmake and not a copy of it (which we had in kdelibs until recently), making FPHSA do something automatically does not help. So, FindBZip2.cmake today sets BZIP2_FOUND as is stated in the docs. I just had a look at the implementation, it uses FPHSA. If we would change FPHSA to also set BZip2_FOUND, *nothing* would force us to touch FindBZip2.cmake, so the documentation may stay unchanged (even more so for Find-modules outside cmake). Now a developer using cmake 2.8.11 may, maybe accidentially, i.e. without checking the unchanged documentation, use BZip2_FOUND and sees it works for him. So he thinks its fine. There is no mention in the docs of BZip2_FOUND, so why should he figure that this means he now requires cmake 2.8.11 ? Not even the documentation for find_package() can say that. At best it could say something like Many Find-modules use FPHSA(), and those will set PackageName_FOUND. Check the documentation of the module in question to see whether this applies to the modules you are using. E.g. in kdelibs we have a FindExiv2.cmake, it uses FPHSA and sets EXIV2_FOUND. If FPHSA would set Exiv2_FOUND automatically, FindExiv2.cmake could not even document that. It would have to say when used with cmake = 2.8.11, it also sets BZip2_FOUND. But even this would require that the author/maintainer of the Find-module is aware of this change in cmake, and actually changes the documentation accordingly. The situation is *much* better if this is not done automatically, but on explicit request. Then if the author decides he wants to use ExactCase_FOUND, it is a deliberate decision, he edits the file to add the necessary option when calling FPHSA, and at the same time he can adapt the documentation. 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] Setting ExactCase_FOUND in FPHSA
Alexander Neundorf wrote: On Friday 15 February 2013, Stephen Kelly wrote: Hi, FindPackageHandleStandardArgs sets an uppercase found variable, but not an ExactCase_FOUND variable. This is inconsistent with how config files work. It also imposes on users the necessity that their FOUND variable is uppercase. how about adding an option EXACTCASE, which modules which use ExactCase can use, and so only one of the two variables is set ? I think the ExactCase version needs to be set by default. 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] Setting ExactCase_FOUND in FPHSA
On Monday 18 February 2013, Stephen Kelly wrote: Alexander Neundorf wrote: On Friday 15 February 2013, Stephen Kelly wrote: Hi, FindPackageHandleStandardArgs sets an uppercase found variable, but not an ExactCase_FOUND variable. This is inconsistent with how config files work. It also imposes on users the necessity that their FOUND variable is uppercase. how about adding an option EXACTCASE, which modules which use ExactCase can use, and so only one of the two variables is set ? I think the ExactCase version needs to be set by default. there is, whether we like it or not, currently no guarantee at all which variables will be set by a Find-module. So to find out how to use a Find-module, the developer has to read the documentation, and there he'll find which variable he can use to check whether the package has been found or not. Making FPHSA be default also set the ExactCase version does unfortunately not mean that all Find-modules will from now on always set the ExactCase_FOUND variable, because there is no guarantee that every Find-module uses FPHSA. Or it may use a copy FPHSA.cmake. My point is: the developer should use only those variables from a Find-module which are documented for the specific module. This means it must be an explicit action to enable the ExactCase_FOUND variable, and it must be added to the documentation of that module. I mean, even if FPHSA would set ExactCase_FOUND always by default, there still would be no guarantee at all that after a find_package(Foo) Foo_FOUND will be set, because as a user of that module I don't know whether it uses FPHSA or not. I have to read the documentation. IMO it also is neither more pretty nor more logical to use if( SomePackage_FOUND ) include_directories( ${SOMEPACKAGE_INCLUDE_DIRS} ) set( libs ${libs} ${SOMEPACKAGE_LIBRARIES} ) endif() instead of if( SOMEPACKAGE_FOUND ) include_directories( ${SOMEPACKAGE_INCLUDE_DIRS} ) set( libs ${libs} ${SOMEPACKAGE_LIBRARIES} ) endif() If somebody decides that his new Find-module will be ExactCase, fine, he will document that, and all the variables will be consistent ExactCase. If a module maintainer decides to switch his module completely to ExactCase (while doing whatever necessary for backward compatibility), he can do so, and make all the variables including the _FOUND variable ExactCase. So I think it should be an explicit switch. 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] Setting ExactCase_FOUND in FPHSA
Alexander Neundorf wrote: I mean, even if FPHSA would set ExactCase_FOUND always by default, there still would be no guarantee at all that after a find_package(Foo) Foo_FOUND will be set, because as a user of that module I don't know whether it uses FPHSA or not. I have to read the documentation. If you want to set the text on a text-related Qt widget, there's no guarantee that the method you want is setText. It usually deliberately is, but you have to read the documentation to be sure :). Anyway, I don't agree with your conclusion, but I guess Brad gets the casting vote of doing nothing or not. I understand your position and you understand mine I'm sure. All that's needed is to decide :). 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] Setting ExactCase_FOUND in FPHSA
On 02/18/2013 04:52 PM, Stephen Kelly wrote: Anyway, I don't agree with your conclusion, but I guess Brad gets the casting vote of doing nothing or not. I understand your position and you understand mine I'm sure. All that's needed is to decide :). One thing that has always bothered me about FPHSA is that modules using it have no mention of a _FOUND variable in the call to it. It is just magically set under the hood. A module author needs to read FPHSA docs to know what _FOUND variable will be set. OTOH we already pass pkg_INCLUDE_DIR, pkg_LIBRARY, and other pkg_ variables to FPHSA: FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY) so that it can check if everything is found. Why not also pass in the name of the _FOUND variable e.g. FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Foo_FOUND) ? Then it is clear when reading the call site what the _FOUND variable is called. It also makes it clearer when reading the module when _FOUND is set. This way the default behavior with no FOUND_VAR option can stay as it is now for compatibility. Then we just proliferate the convention of using the option. -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] Setting ExactCase_FOUND in FPHSA
Am Montag, 18. Februar 2013, 17:17:40 schrieb Brad King: On 02/18/2013 04:52 PM, Stephen Kelly wrote: Anyway, I don't agree with your conclusion, but I guess Brad gets the casting vote of doing nothing or not. I understand your position and you understand mine I'm sure. All that's needed is to decide :). One thing that has always bothered me about FPHSA is that modules using it have no mention of a _FOUND variable in the call to it. It is just magically set under the hood. A module author needs to read FPHSA docs to know what _FOUND variable will be set. OTOH we already pass pkg_INCLUDE_DIR, pkg_LIBRARY, and other pkg_ variables to FPHSA: FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY) so that it can check if everything is found. Why not also pass in the name of the _FOUND variable e.g. FPHSA(Foo DEFAULT_MSG FOO_INCLUDE_DIR FOO_LIBRARY FOUND_VAR Foo_FOUND) ? Then it is clear when reading the call site what the _FOUND variable is called. It also makes it clearer when reading the module when _FOUND is set. This way the default behavior with no FOUND_VAR option can stay as it is now for compatibility. Then we just proliferate the convention of using the option. One could even go so far and issue a dev warning in case FOUND_VAR is not explicitely specified and the minimum required version is not 2.8.11 or 12. Eike signature.asc Description: This is a digitally signed message part. -- 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