Aurélien Gâteau wrote:

>> Here is an updated patch.

Hi,

Without your patch with this code:

 find_dependency(Foo "")

I get:

 CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:34 (if):
   if given arguments:

     "STREQUAL" "EXACT"

   Unknown arguments specified
 Call Stack (most recent call first):
   CMakeLists.txt:20 (find_dependency)


and I can use that information and backtrace to find the bug in my code. 

If I write this code:

 find_dependency(Foo problem)

I get

 CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:62 (find_package):
   find_package called with invalid argument "problem"
 Call Stack (most recent call first):
   CMakeLists.txt:20 (find_dependency)


Does that case need to be handled in the find_dependency macro too? Does it 
need to validate that the version is a number? 

How strongly do you feel about this? Macros are already very hard to write 
correctly, and I am concerned that making the implementation more 
complicated where not needed is likely to lead to more bugs.

For me, letting the existing APIs (like if() and find_package()) do the 
error checking is better than attempting to wrap and validate everything in 
a macro.

Thanks,

Steve.


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to