Merge pull request #278 from rolk/278_linkver
Print linker version to log when configuring
This commit is contained in:
commit
efc44daf76
@ -50,6 +50,7 @@ vcs_info ()
|
|||||||
# print toolchain information to identify compilers with potential bugs
|
# print toolchain information to identify compilers with potential bugs
|
||||||
include (UseCompVer)
|
include (UseCompVer)
|
||||||
compiler_info ()
|
compiler_info ()
|
||||||
|
linker_info ()
|
||||||
|
|
||||||
# default settings: build static debug library
|
# default settings: build static debug library
|
||||||
include (OpmDefaults)
|
include (OpmDefaults)
|
||||||
|
@ -45,3 +45,34 @@ function (compiler_info)
|
|||||||
message (STATUS "GNU C++ compiler version: ${version}")
|
message (STATUS "GNU C++ compiler version: ${version}")
|
||||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
endfunction (compiler_info)
|
endfunction (compiler_info)
|
||||||
|
|
||||||
|
function (get_ld_version ver_name)
|
||||||
|
# run linker to get the version number. interestingly, this option works
|
||||||
|
# (for our purposes) on all major platforms (Linux, Mac OS X and Windows);
|
||||||
|
# it returns the program version although it may have ended in error
|
||||||
|
exec_program (${CMAKE_LINKER}
|
||||||
|
ARGS "-v"
|
||||||
|
OUTPUT_VARIABLE _version
|
||||||
|
)
|
||||||
|
|
||||||
|
# keep only first line, even on Mac OS X there is no line end
|
||||||
|
list (GET _version 0 _version)
|
||||||
|
|
||||||
|
# format of the version string is platform-specific
|
||||||
|
if (NOT WIN32)
|
||||||
|
if (APPLE)
|
||||||
|
string (REGEX REPLACE ".*, from Apple (.*\)" "\\1" _version "${_version}")
|
||||||
|
else (APPLE)
|
||||||
|
# assuming some GNU toolchain now
|
||||||
|
string (REGEX REPLACE "GNU ([a-zA-Z0-9_]*) (version|\\(.*\\)) ([^\\ ]*).*" "\\1 \\3" _version "${_version}")
|
||||||
|
endif (APPLE)
|
||||||
|
endif (NOT WIN32)
|
||||||
|
|
||||||
|
# return the string to the caller
|
||||||
|
set (${ver_name} "${_version}" PARENT_SCOPE)
|
||||||
|
endfunction (get_ld_version ver_name)
|
||||||
|
|
||||||
|
function (linker_info)
|
||||||
|
get_ld_version (version)
|
||||||
|
message (STATUS "Linker: ${version}")
|
||||||
|
endfunction (linker_info)
|
||||||
|
Loading…
Reference in New Issue
Block a user