diff options
author | DRC <information@virtualgl.org> | 2015-10-17 18:13:05 -0500 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-10-27 14:10:20 +0100 |
commit | 2a2e2c3611e660da3f30744cb720bf363a4d3a01 (patch) | |
tree | 45842fa26fb27481f0536a3b91a8a1036b7ca96a /cmake | |
parent | 643f16527514b5e2a012261e0204dbd856677f27 (diff) | |
download | tigervnc-2a2e2c3611e660da3f30744cb720bf363a4d3a01.tar.gz tigervnc-2a2e2c3611e660da3f30744cb720bf363a4d3a01.zip |
Allow static linking against only the GCC libs
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/StaticBuild.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index 25c10777..5a3d9987 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -10,9 +10,14 @@ option(BUILD_STATIC "Link statically against most libraries, if possible" OFF) +option(BUILD_STATIC_GCC + "Link statically against only libgcc and libstdc++" OFF) + if(BUILD_STATIC) message(STATUS "Attempting to link static binaries...") + set(BUILD_STATIC_GCC 1) + set(JPEG_LIBRARIES "-Wl,-Bstatic -ljpeg -Wl,-Bdynamic") if(WIN32) @@ -105,7 +110,9 @@ if(BUILD_STATIC) set(X11_Xdamage_LIB "-Wl,-Bstatic -lXdamage -Wl,-Bdynamic") endif() endif() +endif() +if(BUILD_STATIC_GCC) # This ensures that we don't depend on libstdc++ or libgcc_s set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nodefaultlibs") set(STATIC_BASE_LIBRARIES "-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic") @@ -122,5 +129,4 @@ if(BUILD_STATIC) set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lgcc -lgcc_eh -lc") endif() set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${STATIC_BASE_LIBRARIES}") - endif() |