summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a802e3ac3..35b17a7564 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,8 @@ option(ENABLE_SECURITY "Security Ford protocol protection" ON)
option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON)
option(ENABLE_EXTENDED_POLICY "Turns extended flow which requires embedded system interaction" ON)
option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON)
+option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
+
set(OS_TYPE_OPTION "$ENV{OS_TYPE}")
set(DEBUG_OPTION "$ENV{DEBUG}")
set(HMI_TYPE_OPTION "$ENV{HMI_TYPE}")
@@ -186,6 +188,17 @@ set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wno-deprecated-declarations -Wuninitialized -Wvla")
+if (USE_GOLD_LD)
+ execute_process(COMMAND ld -v OUTPUT_VARIABLE result)
+ string(FIND ${result} Binutils GOLD_LD_FOUND)
+ if (GOLD_LD_FOUND EQUAL -1)
+ message(SEND_ERROR "Gold linker not found!")
+ else()
+ message(INFO " Use gold linker")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
+ endif()
+endif(USE_GOLD_LD)
+
if(ENABLE_SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()