]> source.dussan.org Git - tigervnc.git/commitdiff
Fix C linking when doing static builds
authorPierre Ossman <ossman@cendio.se>
Mon, 16 Jul 2018 13:57:40 +0000 (15:57 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 12 Mar 2020 11:03:32 +0000 (12:03 +0100)
cmake/StaticBuild.cmake

index d8cdbe6e212aa1ae58bc4391306422b62ef10e4c..43a0786ee0d5df6d7cccc6b184506eb3311e8959 100644 (file)
@@ -118,7 +118,7 @@ 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")
+  set(STATIC_BASE_LIBRARIES "")
   if(ENABLE_ASAN AND NOT WIN32 AND NOT APPLE)
     set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lm -lpthread")
   endif()
@@ -138,5 +138,6 @@ if(BUILD_STATIC_GCC)
   else()
     set(STATIC_BASE_LIBRARIES "${STATIC_BASE_LIBRARIES} -lgcc -lgcc_eh -lc")
   endif()
-  set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${STATIC_BASE_LIBRARIES}")
+  set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${STATIC_BASE_LIBRARIES}")
+  set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic ${STATIC_BASE_LIBRARIES}")
 endif()