summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 15 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 743cb65..e7bbf15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,15 +59,27 @@ option( WITH_GTK "Build support for GTK" OFF )
#### configure checks ###########################
if( WITH_BACKEND_LIBBFD )
+ message( STATUS "Checking linker version" )
+ execute_process(
+ COMMAND ${CMAKE_LINKER} --version
+ OUTPUT_VARIABLE _linker_version
+ ERROR_VARIABLE _linker_version
+ )
+ string( REGEX REPLACE "^GNU [^\n]* ([^ ]*)\n.*" "\\1" LINKER_VERSION ${_linker_version} )
+ string( REGEX MATCH "^([0-9]+)\\.([0-9]+)(\\.([0-9]+))?.*" LINKER_VERSION_MATCH ${LINKER_VERSION} )
+ math( EXPR LINKER_VERSION_MAJOR "${CMAKE_MATCH_1}+0" )
+ math( EXPR LINKER_VERSION_MINOR "${CMAKE_MATCH_2}+0" )
+ math( EXPR LINKER_VERSION_PATCH "${CMAKE_MATCH_4}+0" )
+ math( EXPR LINKER_VERSION_C "(${LINKER_VERSION_MAJOR}*1000000) + (${LINKER_VERSION_MINOR}*1000) + ${LINKER_VERSION_PATCH}" )
+ set( LINKER_VERSION_C ${LINKER_VERSION_C} CACHE INTERNAL "Linker version as code number" )
+ message( STATUS "Checking linker version - ${LINKER_VERSION}" )
+
tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "-DPACKAGE" "-DPACKAGE_VERSION" )
check_include_file( bfd.h HAVE_BFD_H )
if( NOT HAVE_BFD_H )
tde_message_fatal( "Could not find libbfd header file (bfd.h)!\nThis file is usually included in the package binutils-dev." )
endif( NOT HAVE_BFD_H )
- tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "bfd" )
- check_symbol_exists( bfd_asymbol_section bfd.h HAVE_BFD_2_34 )
tde_restore( CMAKE_REQUIRED_DEFINITIONS )
- tde_restore( CMAKE_REQUIRED_LIBRARIES )
set( BACKEND_LIBRARIES "-lbfd" )
set( LIBR_BACKEND "bfd" )
set( BACKEND_NAME "libbfd" )