I would like to propose/submit a few changes for FindSoci.cmake.
I am attaching my diff for convenience and I am also pasting it inline for 
annotation.

--- cmake/modules/FindSoci.cmake        2011-09-25 01:53:43.000000000 +0300
+++ cmake/Modules/FindSoci.cmake        2012-06-05 17:09:35.169767802 +0300
@@ -60,7 +60,7 @@
 IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY)

     MESSAGE(STATUS "Soci found: Looking for plugins")
-    FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS)
+    FOREACH(plugin ${_SOCI_ALL_PLUGINS})

         FIND_LIBRARY(
             SOCI_${plugin}_PLUGIN

I had to make this change to use FindSoci.cmake with older CMake 2.6 as found on
some Enterprise Linux distributions.

@@ -70,7 +70,7 @@
         MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)

         IF(SOCI_${plugin}_PLUGIN)
-            MESSAGE(STATUS "    * Plugin ${plugin} found 
${SOCI_${plugin}_LIBRARY}.")
+            MESSAGE(STATUS "    * Plugin ${plugin} found 
${SOCI_${plugin}_PLUGIN}.")
             SET(SOCI_${plugin}_FOUND True)
         ELSE()
             MESSAGE(STATUS "    * Plugin ${plugin} not found.")

It seems that SOCI_${plugin}_LIBRARY variables are not actually defined and
SOCI_${plugin}_PLUGIN is what should be reported.

@@ -83,9 +83,7 @@
     ### FOURTH CHECK: Check if the required components were all found
     #
     FOREACH(component ${Soci_FIND_COMPONENTS})
-        IF(${SOCI_${component}_FOUND})
-            # Does not work with NOT ... . No idea why.
-        ELSE()
+        IF(NOT SOCI_${component}_FOUND)
             MESSAGE(SEND_ERROR "Required component ${component} not found.")
         ENDIF()
     ENDFOREACH()

It seems that conditionals require variable names and do value expansion
internally.  So I hope that this change makes code work correctly and also 
clears
the confusion expressed in the comment.

Also, it might make sense to add "oracle" to _SOCI_ALL_PLUGINS.  It doesn't have
to be present but it doesn't hurt to check for its availability.

Thank you.
-- 
Andriy Gapon

--- cmake/modules/FindSoci.cmake        2011-09-25 01:53:43.000000000 +0300
+++ cmake/Modules/FindSoci.cmake        2012-06-05 17:09:35.169767802 +0300
@@ -60,7 +60,7 @@
 IF(SOCI_INCLUDE_DIR AND SOCI_LIBRARY)
 
     MESSAGE(STATUS "Soci found: Looking for plugins")
-    FOREACH(plugin IN LISTS _SOCI_ALL_PLUGINS)
+    FOREACH(plugin ${_SOCI_ALL_PLUGINS})
 
         FIND_LIBRARY(
             SOCI_${plugin}_PLUGIN
@@ -70,7 +70,7 @@
         MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
 
         IF(SOCI_${plugin}_PLUGIN)
-            MESSAGE(STATUS "    * Plugin ${plugin} found 
${SOCI_${plugin}_LIBRARY}.")
+            MESSAGE(STATUS "    * Plugin ${plugin} found 
${SOCI_${plugin}_PLUGIN}.")
             SET(SOCI_${plugin}_FOUND True)
         ELSE()
             MESSAGE(STATUS "    * Plugin ${plugin} not found.")
@@ -83,9 +83,7 @@
     ### FOURTH CHECK: Check if the required components were all found
     #
     FOREACH(component ${Soci_FIND_COMPONENTS})
-        IF(${SOCI_${component}_FOUND})
-            # Does not work with NOT ... . No idea why.
-        ELSE()
+        IF(NOT SOCI_${component}_FOUND)
             MESSAGE(SEND_ERROR "Required component ${component} not found.")
         ENDIF()
     ENDFOREACH()
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to