[Cmake-commits] CMake branch, next, updated. v2.8.7-2662-gf08963b

Alexander Neundorf neundorf at kde.org
Thu Feb 16 17:39:49 EST 2012


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  f08963bf9baf9312ec01ecb8f4eb57486c27083f (commit)
       via  43118d04cbb08814fd98e87afeadcfb703277606 (commit)
      from  d8d31a644abde62197ba3dad669420e87339a924 (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=f08963bf9baf9312ec01ecb8f4eb57486c27083f
commit f08963bf9baf9312ec01ecb8f4eb57486c27083f
Merge: d8d31a6 43118d0
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Thu Feb 16 17:39:44 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 16 17:39:44 2012 -0500

    Merge topic 'HandleTargetsInCMakeRequiredLibraries' into next
    
    43118d0 CMakeExpandImportedTargets: add CONFIGURATION parameter


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43118d04cbb08814fd98e87afeadcfb703277606
commit 43118d04cbb08814fd98e87afeadcfb703277606
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Thu Feb 16 23:35:43 2012 +0100
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Thu Feb 16 23:35:43 2012 +0100

    CMakeExpandImportedTargets: add CONFIGURATION parameter
    
    As pointed out by Brad, now that cmake_expand_imported_targets() is
    more generic, hardcoding to use CMAKE_TRY_COMPILE_CONFIGURATION is not
    a good idea. So add a CONFIGURATION parameter, which defaults to
    CMAKE_CONFIGURATION_TYPES[0] (if set) or CMAKE_BUILD_TYPE otherwise.
    
    Use this with ${CMAKE_TRY_COMPILE_CONFIGURATION} in all the Check*.cmake
    files.
    
    Alex

diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 88dedeb..fba071a 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -1,13 +1,19 @@
-# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN)
+# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
+#                                     [CONFIGURATION <config>] )
 #
 # CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
 # all imported targets contained in this list with their actual file paths
 # of the referenced libraries on disk, including the libraries from their
 # link interfaces.
+# If a CONFIGURATION is given, it uses the respective configuration of the
+# imported targets if it exists. If no CONFIGURATION is given, it uses
+# the first configuration from ${CMAKE_CONFIGURATION_TYPES} if set, otherwise
+# ${CMAKE_BUILD_TYPE}.
 # This macro is used by all Check*.cmake files which use
 # TRY_COMPILE() or TRY_RUN() and support CMAKE_REQUIRED_LIBRARIES , so that
 # these checks support imported targets in CMAKE_REQUIRED_LIBRARIES:
-#    cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
+#    cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
+#                                               CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
 
 
 #=============================================================================
@@ -24,16 +30,31 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
+include(CMakeParseArguments)
 
-function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT _LIB)
+function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
 
-   if(NOT "${_LIB}" STREQUAL "LIBRARIES")
-      message(FATAL_ERROR "cmake_expand_imported_targets() called with bad second argument \"${_LIB}\", expected keyword \"LIBRARIES\".")
+   set(options )
+   set(oneValueArgs CONFIGURATION )
+   set(multiValueArgs LIBRARIES )
+
+   cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
+
+   if(CEIT_UNPARSED_ARGUMENTS)
+      message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"")
+   endif()
+
+   if(NOT CEIT_CONFIGURATION)
+      if(CMAKE_CONFIGURATION_TYPES)
+         list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION)
+      else()
+         set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE})
+      endif()
    endif()
 
    # handle imported library targets
 
-   set(_CCSR_REQ_LIBS ${ARGN})
+   set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES})
 
    set(_CHECK_FOR_IMPORTED_TARGETS TRUE)
    set(_CCSR_LOOP_COUNTER 0)
@@ -61,7 +82,7 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT _LIB)
 
             # if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION},
             # use it, otherwise simply use the first one:
-            list(FIND _importedConfigs "${CMAKE_TRY_COMPILE_CONFIGURATION}" _configIndexToUse)
+            list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse)
             if("${_configIndexToUse}" EQUAL -1)
               set(_configIndexToUse 0)
             endif("${_configIndexToUse}" EQUAL -1)
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 9a07856..2669336 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -44,7 +44,7 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index e29f8b9..feee93a 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -33,7 +33,7 @@ MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index e70312a..7f7336e 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -45,7 +45,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index 1319c2f..cd68d57 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -33,7 +33,7 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 0589bd9..abec9f7 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -30,7 +30,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
     message(STATUS "Looking for Fortran ${FUNCTION}")
     if(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     else(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index c6225ed..8c469f0 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -37,7 +37,7 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
     MESSAGE(STATUS "Looking for ${FUNCTION}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index c3ec462..59fca0a 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -37,7 +37,7 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
     SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_LIBRARY_EXISTS_LIBRARIES
         ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES})
     ENDIF(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 51b2e2e..63d4242 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -47,7 +47,7 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
     set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
     if (CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       set(CHECK_PROTOTYPE_DEFINITION_LIBS
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     else(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 36b4837..e6e677d 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -48,7 +48,7 @@ MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
     SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_SYMBOL_EXISTS_LIBS
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 8704375..1717718 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -79,7 +79,7 @@ function(__check_type_size_impl type var map builtin)
   # Perform the check.
 
   # this one translates potentially used imported library targets to their files on disk
-  cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+  cmake_expand_imported_targets(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
 
   set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
   set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index 406cdc5..7d6c794 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -36,7 +36,7 @@ MACRO(CHECK_VARIABLE_EXISTS VAR VARIABLE)
     MESSAGE(STATUS "Looking for ${VAR}")
     IF(CMAKE_REQUIRED_LIBRARIES)
       # this one translates potentially used imported library targets to their files on disk
-      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} )
+      CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES  LIBRARIES  ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
       SET(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
         "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
     ELSE(CMAKE_REQUIRED_LIBRARIES)

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

Summary of changes:
 Modules/CMakeExpandImportedTargets.cmake |   35 ++++++++++++++++++++++++------
 Modules/CheckCSourceCompiles.cmake       |    2 +-
 Modules/CheckCSourceRuns.cmake           |    2 +-
 Modules/CheckCXXSourceCompiles.cmake     |    2 +-
 Modules/CheckCXXSourceRuns.cmake         |    2 +-
 Modules/CheckFortranFunctionExists.cmake |    2 +-
 Modules/CheckFunctionExists.cmake        |    2 +-
 Modules/CheckLibraryExists.cmake         |    2 +-
 Modules/CheckPrototypeDefinition.cmake   |    2 +-
 Modules/CheckSymbolExists.cmake          |    2 +-
 Modules/CheckTypeSize.cmake              |    2 +-
 Modules/CheckVariableExists.cmake        |    2 +-
 12 files changed, 39 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list