[mapguide-commits] r9320 - trunk/MgDev

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Feb 1 05:10:44 PST 2018


Author: jng
Date: 2018-02-01 05:10:44 -0800 (Thu, 01 Feb 2018)
New Revision: 9320

Modified:
   trunk/MgDev/CMakeLists.txt
   trunk/MgDev/cmake_build.sh
Log:
Add gold linker support for CMake build if available. Fixes #2557

Modified: trunk/MgDev/CMakeLists.txt
===================================================================
--- trunk/MgDev/CMakeLists.txt	2018-01-30 12:48:40 UTC (rev 9319)
+++ trunk/MgDev/CMakeLists.txt	2018-02-01 13:10:44 UTC (rev 9320)
@@ -133,6 +133,17 @@
     endif (CMAKE_BUILD_TYPE MATCHES DEBUG)
 endif(CMAKE_COMPILER_IS_GNUCXX)
 
+if (USE_LD_GOLD)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+    if ("${LD_VERSION}" MATCHES "GNU gold")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
+        message(STATUS "Using GNU gold linker instead of ld")
+    else ()
+        message(WARNING "GNU gold linker isn't available, using the default system linker.")
+    endif ()
+endif ()
+
 find_package(Sanitizers)
 find_package(GEOS REQUIRED)
 find_package(ACE REQUIRED)

Modified: trunk/MgDev/cmake_build.sh
===================================================================
--- trunk/MgDev/cmake_build.sh	2018-01-30 12:48:40 UTC (rev 9319)
+++ trunk/MgDev/cmake_build.sh	2018-02-01 13:10:44 UTC (rev 9320)
@@ -9,6 +9,7 @@
 #HAVE_SYSTEM_XERCES=0
 USE_NINJA=0
 USE_ASAN=OFF
+USE_LD_GOLD=OFF
 while [ $# -gt 0 ]; do    # Until you run out of parameters...
     case "$1" in
         --cmake-build-dir)
@@ -25,12 +26,16 @@
         --with-asan)
             USE_ASAN=ON
             ;;
+        --with-gold)
+            USE_LD_GOLD=ON
+            ;;
         --help)
             echo "Usage: $0 (options)"
             echo "Options:"
             echo "  --cmake-build-dir [CMake build directory]"
             echo "  --oem-working-dir [installation directory]"
-            echo "  --with-asan [build with ASAN]"
+            echo "  --with-asan [build with ASAN (if available)]"
+            echo "  --with-gold [link with gold instead of ld (if available)]"
             echo "  --ninja [Use ninja build system]"
             echo "  --help [Display usage]"
             exit



More information about the mapguide-commits mailing list