[CMake] FindSubversion does not handle REQUIRED option

Marcel Loose loose at astron.nl
Thu Jan 28 04:07:31 EST 2010


There's a bug in the current FindSubversion.cmake, which causes it to
ignore the REQUIRED option, when option QUIET is not given. The
following patch solves this. IMHO, it would be even better to use FPHSA
for this.

Furthermore, I'm not sure whether it's desirable to conditionally define
macros. This puts the burden on the user to check Subversion_FOUND
first, before calling, e.g., Subversion_WC_INFO. I'd prefer to do this
inside the macro Subversion_WC_INFO.

Just my 2 cents.
Marcel Loose.


Index: FindSubversion.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/FindSubversion.cmake,v
retrieving revision 1.5
diff -u -r1.5 FindSubversion.cmake
--- FindSubversion.cmake        28 Sep 2009 15:45:46 -0000      1.5
+++ FindSubversion.cmake        28 Jan 2010 08:54:18 -0000
@@ -110,13 +110,13 @@
 ENDIF(Subversion_SVN_EXECUTABLE)

 IF(NOT Subversion_FOUND)
-  IF(NOT Subversion_FIND_QUIETLY)
-    MESSAGE(STATUS "Subversion was not found.")
-  ELSE(NOT Subversion_FIND_QUIETLY)
-    IF(Subversion_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Subversion was not found.")
-    ENDIF(Subversion_FIND_REQUIRED)
-  ENDIF(NOT Subversion_FIND_QUIETLY)
+  IF(Subversion_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "Subversion was not found.")
+  ELSE(Subversion_FIND_REQUIRED)
+    IF(NOT Subversion_FIND_QUIETLY)
+      MESSAGE(STATUS "Subversion was not found.")
+    ENDIF(NOT Subversion_FIND_QUIETLY)
+  ENDIF(Subversion_FIND_REQUIRED)
 ENDIF(NOT Subversion_FOUND)

 # FindSubversion.cmake ends here.




More information about the CMake mailing list