[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3223-g9dd3cc6

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Thu Jul 18 11:53:21 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  9dd3cc62fd9766b561431b33852ece78a57d85aa (commit)
       via  5cd32c2c74cb43a08f7483b2595e3036c02109eb (commit)
       via  07b44e7a1f3facf3b4300fb98bfa0705ef728bce (commit)
      from  6144dceb490a72d0d39d2ecbeec01d0bbe2cf744 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9dd3cc62fd9766b561431b33852ece78a57d85aa
commit 9dd3cc62fd9766b561431b33852ece78a57d85aa
Merge: 6144dce 5cd32c2
Author:     Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
AuthorDate: Thu Jul 18 11:53:18 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jul 18 11:53:18 2013 -0400

    Merge topic 'SelectLibraryConfigurations' into next
    
    5cd32c2 SelectLibraryConfigurations: Use -NOTFOUND instead of copying the vars
    07b44e7 SelectLibraryConfigurations: Do not cache the _LIBRARY variable


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cd32c2c74cb43a08f7483b2595e3036c02109eb
commit 5cd32c2c74cb43a08f7483b2595e3036c02109eb
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Mon Jul 8 17:37:18 2013 +0200
Commit:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
CommitDate: Wed Jul 10 15:21:36 2013 +0200

    SelectLibraryConfigurations: Use -NOTFOUND instead of copying the vars
    
    If one of the libraries (_DEBUG or _RELEASE) is not set, the value is
    set to the value of the other one.
    FindQt4, from which the macro is extracted, sets the values to
    XXX_LIBRARY_{DEBUG,RELEASE}-NOTFOUND instead.
    In both cases the XXX_LIBRARY is correct, but using NOTFOUND makes it
    easier to understand which one is missing.

diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index f475d87..297e1d3 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -3,16 +3,18 @@
 # This macro takes a library base name as an argument, and will choose good
 # values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and
 # basename_LIBRARY_RELEASE depending on what has been found and set.  If only
-# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
-# and basename_LIBRARY_RELEASE will be set to the release value.  If only
-# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
-# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
+# basename_LIBRARY_RELEASE is defined, basename_LIBRARY will be set to the
+# release value, and basename_LIBRARY_DEBUG will be set to
+# basename_LIBRARY_DEBUG-NOTFOUND.  If only basename_LIBRARY_DEBUG is defined,
+# then basename_LIBRARY will take the debug value, and basename_LIBRARY_RELEASE
+# will be set to basename_LIBRARY_RELEASE-NOTFOUND.
 #
 # If the generator supports configuration types, then basename_LIBRARY and
 # basename_LIBRARIES will be set with debug and optimized flags specifying the
 # library to be used for the given configuration.  If no build type has been set
 # or the generator in use does not support configuration types, then
-# basename_LIBRARY and basename_LIBRARIES will take only the release values.
+# basename_LIBRARY and basename_LIBRARIES will take only the release value, or
+# the debug value if the release one is not set.
 
 #=============================================================================
 # Copyright 2009 Will Dicharry <wdicharry at stellarscience.com>
@@ -31,48 +33,36 @@
 # This macro was adapted from the FindQt4 CMake module and is maintained by Will
 # Dicharry <wdicharry at stellarscience.com>.
 
-# Utility macro to check if one variable exists while another doesn't, and set
-# one that doesn't exist to the one that exists.
-macro( _set_library_name basename GOOD BAD )
-    if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
-        set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
-        set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
-        set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
-    endif()
-endmacro()
-
 macro( select_library_configurations basename )
-    # if only the release version was found, set the debug to be the release
-    # version.
-    _set_library_name( ${basename} RELEASE DEBUG )
-    # if only the debug version was found, set the release value to be the
-    # debug value.
-    _set_library_name( ${basename} DEBUG RELEASE )
-
-    # Set a default case, which will come into effect if
-    # -no build type is set and the generator only supports one build type
-    #  at a time (i.e. CMAKE_CONFIGURATION_TYPES is false)
-    # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are the same
-    # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are both empty
-    set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
-    set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
+    if(NOT ${basename}_LIBRARY_RELEASE)
+        set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
+    endif()
+    if(NOT ${basename}_LIBRARY_DEBUG)
+        set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
+    endif()
 
     if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
-           NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE )
+           NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
+           ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) )
         # if the generator supports configuration types or CMAKE_BUILD_TYPE
         # is set, then set optimized and debug options.
-        if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
-            set( ${basename}_LIBRARY "" )
-            foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
-                list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
-            endforeach()
-            foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
-                list( APPEND ${basename}_LIBRARY debug "${_libname}" )
-            endforeach()
-            set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
-        endif()
+        set( ${basename}_LIBRARY "" )
+        foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
+            list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
+        endforeach()
+        foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
+            list( APPEND ${basename}_LIBRARY debug "${_libname}" )
+        endforeach()
+    elseif( ${basename}_LIBRARY_RELEASE )
+        set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
+    elseif( ${basename}_LIBRARY_DEBUG )
+        set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
+    else()
+        set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
     endif()
 
+    set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
+
     if( ${basename}_LIBRARY )
         set( ${basename}_FOUND TRUE )
     endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07b44e7a1f3facf3b4300fb98bfa0705ef728bce
commit 07b44e7a1f3facf3b4300fb98bfa0705ef728bce
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Mon Jul 8 14:37:23 2013 +0200
Commit:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
CommitDate: Wed Jul 10 15:06:01 2013 +0200

    SelectLibraryConfigurations: Do not cache the _LIBRARY variable
    
    SelectLibraryConfigurations module currently cache and mark as advanced
    the variable ${basename}_LIBRARY.
    ${basename}_LIBRARY_RELEASE and ${basename}_LIBRARY_DEBUG are usually
    cached, because they often come from find_library().
    ${basename}_LIBRARY on the other hand is always of type
    "optimized;${${basename}_LIBRARY_RELEASE};debug;${${basename}_LIBRARY_DEBUG}"
    or just "${basename}_LIBRARY_RELEASE" or "${basename}_LIBRARY_DEBUG" if
    only one version of the library is not found, if both have the same
    value, or if configuration types are not supported.
    
    Caching and marking as advanced just ${basename}_LIBRARY_RELEASE and
    ${basename}_LIBRARY_DEBUG is enough, just by modifying these two
    variables, the user has enough control on finding the library, and
    having 3 variables is redundant and confusing.

diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 5bca064..f475d87 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -73,15 +73,11 @@ macro( select_library_configurations basename )
         endif()
     endif()
 
-    set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
-        "The ${basename} library" )
-
     if( ${basename}_LIBRARY )
         set( ${basename}_FOUND TRUE )
     endif()
 
-    mark_as_advanced( ${basename}_LIBRARY
-        ${basename}_LIBRARY_RELEASE
+    mark_as_advanced( ${basename}_LIBRARY_RELEASE
         ${basename}_LIBRARY_DEBUG
     )
 endmacro()

-----------------------------------------------------------------------

Summary of changes:
 Modules/SelectLibraryConfigurations.cmake |   74 ++++++++++++-----------------
 1 files changed, 30 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list