[Cmake-commits] [cmake-commits] king committed CMakeParseImplicitLinkInfo.cmake 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Nov 5 12:17:10 EST 2009


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv3529/Modules

Modified Files:
	CMakeParseImplicitLinkInfo.cmake 
Log Message:
Remove non-language implicit link dependencies

Some compilers use implicit link options of the form

  -lcrt*.o
  -lgcc*
  -lSystem      (on Mac)
  -lSystemStubs (on Mac)

that provide system-wide symbols not specific to any language.
These need not be listed explicitly for mixed-language linking.

We teach CMake to remove the above items from the implicit library list
of each language.  This change makes it possible to mix GNU compiler
versions in some cases.


Index: CMakeParseImplicitLinkInfo.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeParseImplicitLinkInfo.cmake,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** CMakeParseImplicitLinkInfo.cmake	7 Oct 2009 12:43:51 -0000	1.7
--- CMakeParseImplicitLinkInfo.cmake	5 Nov 2009 17:17:06 -0000	1.8
***************
*** 18,22 ****
  
  function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var)
!   set(implicit_libs "")
    set(implicit_dirs_tmp)
    set(log "")
--- 18,22 ----
  
  function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var)
!   set(implicit_libs_tmp "")
    set(implicit_dirs_tmp)
    set(log "")
***************
*** 54,62 ****
            # Unix library.
            string(REGEX REPLACE "^-l" "" lib "${arg}")
!           list(APPEND implicit_libs ${lib})
            set(log "${log}    arg [${arg}] ==> lib [${lib}]\n")
          elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
            # Unix library full path.
!           list(APPEND implicit_libs ${arg})
            set(log "${log}    arg [${arg}] ==> lib [${arg}]\n")
          elseif("${arg}" MATCHES "^-Y(P,)?")
--- 54,62 ----
            # Unix library.
            string(REGEX REPLACE "^-l" "" lib "${arg}")
!           list(APPEND implicit_libs_tmp ${lib})
            set(log "${log}    arg [${arg}] ==> lib [${lib}]\n")
          elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$")
            # Unix library full path.
!           list(APPEND implicit_libs_tmp ${arg})
            set(log "${log}    arg [${arg}] ==> lib [${arg}]\n")
          elseif("${arg}" MATCHES "^-Y(P,)?")
***************
*** 68,76 ****
          elseif("${arg}" MATCHES "^-l:")
            # HP named library.
!           list(APPEND implicit_libs ${arg})
            set(log "${log}    arg [${arg}] ==> lib [${arg}]\n")
          elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
            # Link editor option.
!           list(APPEND implicit_libs ${arg})
            set(log "${log}    arg [${arg}] ==> opt [${arg}]\n")
          else()
--- 68,76 ----
          elseif("${arg}" MATCHES "^-l:")
            # HP named library.
!           list(APPEND implicit_libs_tmp ${arg})
            set(log "${log}    arg [${arg}] ==> lib [${arg}]\n")
          elseif("${arg}" MATCHES "^-z(all|default|weak)extract")
            # Link editor option.
!           list(APPEND implicit_libs_tmp ${arg})
            set(log "${log}    arg [${arg}] ==> opt [${arg}]\n")
          else()
***************
*** 91,94 ****
--- 91,105 ----
    endforeach()
  
+   # Cleanup list of libraries and flags.
+   # We remove items that are not language-specific.
+   set(implicit_libs "")
+   foreach(lib IN LISTS implicit_libs_tmp)
+     if("${lib}" MATCHES "^(crt.*\\.o|gcc.*|System.*)$")
+       set(log "${log}  remove lib [${lib}]\n")
+     else()
+       list(APPEND implicit_libs "${lib}")
+     endif()
+   endforeach()
+ 
    # Cleanup list of directories.
    set(implicit_dirs "")



More information about the Cmake-commits mailing list