Revision: 41711
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41711&view=rev
Author:   starseeker
Date:     2010-12-19 16:40:17 +0000 (Sun, 19 Dec 2010)

Log Message:
-----------
Use the VERSION_LESS, VERSION_EQUAL and VERSION_GREATER fatures of the if test, 
instead of our own custom macro. (wish these had been called out more boldly by 
the CMake documentation...)  Needs testing to make sure it behaves as expected, 
but should be a good cleanup.

Modified Paths:
--------------
    brlcad/branches/cmake/misc/CMake/FindTCL.cmake

Removed Paths:
-------------
    brlcad/branches/cmake/misc/CMake/CompareVersions.cmake

Deleted: brlcad/branches/cmake/misc/CMake/CompareVersions.cmake
===================================================================
--- brlcad/branches/cmake/misc/CMake/CompareVersions.cmake      2010-12-19 
06:41:14 UTC (rev 41710)
+++ brlcad/branches/cmake/misc/CMake/CompareVersions.cmake      2010-12-19 
16:40:17 UTC (rev 41711)
@@ -1,60 +0,0 @@
-# Note that these routines don't (yet) handle letters in versions
-
-MACRO(COMPARE_VERSIONS version1 version2 resultvar)
-   SET(compnum1 "")
-   SET(compnum2 "")
-   STRING(REGEX REPLACE "[.-]" ";" LIST1 "${version1}")
-   STRING(REGEX REPLACE "[.-]" ";" LIST2 "${version2}")
-   list(LENGTH LIST1 LEN1)
-   list(LENGTH LIST2 LEN2)
-   WHILE (LEN1 GREATER LEN2)
-       math(EXPR LEN1 "${LEN1} - 1")
-       LIST(REMOVE_AT LIST1 ${LEN1})
-       list(LENGTH LIST1 LEN1)
-   ENDWHILE()      
-   WHILE (LEN2 GREATER LEN1)
-       math(EXPR LEN2 "${LEN2} - 1")
-       LIST(REMOVE_AT LIST2 ${LEN2})
-       list(LENGTH LIST2 LEN2)
-   ENDWHILE()      
-   SET(LCOUNT ${LEN2})
-   SET(COUNT 0)
-   while(COUNT LESS LCOUNT)
-       LIST(GET LIST1 ${COUNT} NUM1)
-       LIST(GET LIST2 ${COUNT} NUM2)
-       STRING(LENGTH ${NUM1} N1LEN)
-       STRING(LENGTH ${NUM2} N2LEN)
-       WHILE (N1LEN LESS N2LEN)
-         SET(NUM1 "0${NUM1}")
-          STRING(LENGTH ${NUM1} N1LEN)
-       ENDWHILE()      
-       WHILE (LEN2 GREATER LEN1)
-          SET(NUM2 "0${NUM2}")
-          STRING(LENGTH ${NUM2} N2LEN)
-       ENDWHILE()
-       LIST(INSERT LIST1 ${COUNT} ${NUM1})
-       LIST(INSERT LIST2 ${COUNT} ${NUM2})
-       math(EXPR RMVCNT "${COUNT} + 1")
-       LIST(REMOVE_AT LIST1 ${RMVCNT})
-       LIST(REMOVE_AT LIST2 ${RMVCNT})
-       math(EXPR COUNT "${COUNT} + 1")
-    endwhile()
-    LIST(REVERSE LIST1)
-    LIST(REVERSE LIST2)
-    FOREACH(num ${LIST1})
-      SET(compnum1 "${num}${compnum1}")
-    ENDFOREACH ()
-    FOREACH(num ${LIST2})
-      SET(compnum2 "${num}${compnum2}")
-    ENDFOREACH ()
-    IF(${compnum1} GREATER ${compnum2})
-       SET(${resultvar} 1)
-    ENDIF()
-    IF(${compnum2} GREATER ${compnum1})
-       SET(${resultvar} 2)
-    ENDIF()
-    if (NOT ${resultvar})
-       SET(${resultvar} 0)
-    endif()
-ENDMACRO(COMPARE_VERSIONS)
-

Modified: brlcad/branches/cmake/misc/CMake/FindTCL.cmake
===================================================================
--- brlcad/branches/cmake/misc/CMake/FindTCL.cmake      2010-12-19 06:41:14 UTC 
(rev 41710)
+++ brlcad/branches/cmake/misc/CMake/FindTCL.cmake      2010-12-19 16:40:17 UTC 
(rev 41711)
@@ -247,38 +247,37 @@
 # In various loops, we don't want to waste time checking for paths containing
 # version numbers incompatible with restrictions imposed by the min/max/exact
 # variables.  Define a version to validate a given version against those
-# variables, if they are defined.  Requires CompareVersions.cmake
-INCLUDE(CompareVersions)
+# variables, if they are defined.
 MACRO(VALIDATE_VERSION vstatus versionnum)
        SET(${vstatus} "NOTFOUND")
-       SET(vcompare "NOTFOUND")
        if(TCL_EXACT_VERSION)
-               COMPARE_VERSIONS(${TCL_EXACT_VERSION} ${versionnum} vcompare)
-               IF(NOT vcompare)
+               IF(${TCL_EXACT_VERSION} VERSION_EQUAL ${versionnum})
                        SET(${vstatus} 1)
                ELSE()
                        SET(${vstatus} 0)
                endif()
        else()
+               SET(vminpass "NOTFOUND")
+               SET(vmaxpass "NOTFOUND")
                if(TCL_MIN_VERSION)
-                       SET(vmincompare "NOTFOUND")
-                       COMPARE_VERSIONS(${TCL_MIN_VERSION} ${versionnum} 
vmincompare)
-                       if(NOT vmincompare)
-                               SET(vmincompare 2)
+                       if(${versionnum} VERSION_LESS ${TCL_MIN_VERSION})
+                               SET(vminpass 0)
+             else()
+                          SET(vminpass 1)
                        endif()
                else()
-                       SET(vmincompare 2)
+                       SET(vminpass 1)
                endif()
                if(TCL_MAX_VERSION)
-                       SET(vmaxcompare "NOTFOUND")
-                       COMPARE_VERSIONS(${TCL_MAX_VERSION} ${versionnum} 
vmaxcompare)
-                       if(NOT vmaxcompare)
-                               SET(vmaxcompare 1)
+                       if(${versionnum} VERSION_GREATER ${TCL_MIN_VERSION})
+                               SET(vmaxpass 0)
+                       else()
+                          SET(vmaxpass 1)
                        endif()
                else()
-                       SET(vmaxcompare 1)
+                       SET(vmaxpass 1)
                endif() 
-               IF(${vmincompare} EQUAL 2 AND ${vmaxcompare} EQUAL 1)
+               IF(${vminpass} EQUAL 1 AND ${vmaxpass} EQUAL 1)
                        SET(${vstatus} 1)
                ELSE()
                        SET(${vstatus} 0)
@@ -797,12 +796,11 @@
                                                SET(TKVALID 0)
                                                SET(CURRENTTKVERSION 
"${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}.${TK_PATCH_LEVEL}")
                                                SET(vtcltkcompare 0)
-                                               
COMPARE_VERSIONS(${CURRENTTCLVERSION} ${CURRENTTKVERSION} vtcltkcompare)
-                                               IF(${vtcltkcompare})
-                                                       SET(TKVALID 0)
-                                               ELSE(${vtcltkcompare})
+                                               IF(${CURRENTTCLVERSION} 
VERSION_EQUAL ${CURRENTTKVERSION})
                                                        SET(TKVALID 1)
-                                               ENDIF(${vtcltkcompare})
+                                               ELSE()
+                                                       SET(TKVALID 0)
+                                               ENDIF()
                                                IF(TKVALID)
                                                        
GET_FILENAME_COMPONENT(TK_CONF_PREFIX "${tk_config_file}" PATH)
                                                        
GET_FILENAME_COMPONENT(TK_LIBRARY_DIR2 "${TK_CONF_PREFIX}" PATH)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to