Commit 8d4fea89 authored by Brenden Blanco's avatar Brenden Blanco

Enhance check for presence of static-libstdc++

* Fixes a link error on Ubuntu when static-libstdc++ is not installed.
Reported-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent a11aab85
......@@ -22,7 +22,13 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
if (CMAKE_COMPILER_IS_GNUCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIB)
get_filename_component(GCC_DIR "${GCC_LIB}" DIRECTORY)
find_library(GCC_LIBSTDCPP libstdc++.a PATHS "${GCC_DIR}" NO_DEFAULT_PATH)
if (GCC_LIBSTDCPP)
message(STATUS "Using static-libstdc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
endif()
endif()
endif()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment