summaryrefslogtreecommitdiff
path: root/Modules/SelectLibraryConfigurations.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2012-07-28 10:25:17 +0200
committerRolf Eike Beer <eike@sf-mail.de>2012-07-29 17:45:53 +0200
commit5797512cec6ce106cf3277c59abd2ccb86ce2846 (patch)
tree2f10cec2079e649dae824a88729e0eeb96c5aa94 /Modules/SelectLibraryConfigurations.cmake
parentaedc2251fef38450dd1dbc217c291d1a9ab0b4f6 (diff)
downloadcmake-5797512cec6ce106cf3277c59abd2ccb86ce2846.tar.gz
SelectLibraryConfiguration: generate correct output when input vars are lists
In case that any of the input variables that hold the library names contains more than just a single library the "debug" or "optimized" keywords were only prepended to the first item, making all other libs appear in all configurations. Just treat both input variables as lists. Thanks to Philipp Berger <newsletters@philippberger.de> for pointing me at this.
Diffstat (limited to 'Modules/SelectLibraryConfigurations.cmake')
-rw-r--r--Modules/SelectLibraryConfigurations.cmake18
1 files changed, 10 insertions, 8 deletions
diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake
index 2e8ade0dfa..dbff4876b1 100644
--- a/Modules/SelectLibraryConfigurations.cmake
+++ b/Modules/SelectLibraryConfigurations.cmake
@@ -48,17 +48,19 @@ macro( select_library_configurations basename )
# if only the debug version was found, set the release value to be the
# debug value.
_set_library_name( ${basename} DEBUG RELEASE )
- if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
- NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE)
+ if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
+ NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE )
# 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
- optimized ${${basename}_LIBRARY_RELEASE}
- debug ${${basename}_LIBRARY_DEBUG} )
- set( ${basename}_LIBRARIES
- optimized ${${basename}_LIBRARY_RELEASE}
- debug ${${basename}_LIBRARY_DEBUG} )
+ set( ${basename}_LIBRARY )
+ foreach( _libname LISTS ${basename}_LIBRARY_RELEASE )
+ list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
+ endforeach()
+ foreach( _libname LISTS ${basename}_LIBRARY_DEBUG )
+ list( APPEND ${basename}_LIBRARY debug "${_libname}" )
+ endforeach()
+ set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
# If there are no configuration types or build type, just use
# the release version