diff options
-rw-r--r-- | cmake/StaticBuild.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index d8cdbe6e..43a0786e 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -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() |