diff --git a/cmake/static_link_runtime.cmake b/cmake/static_link_runtime.cmake index 6e39fe9bf..de944a1c3 100644 --- a/cmake/static_link_runtime.cmake +++ b/cmake/static_link_runtime.cmake @@ -10,7 +10,7 @@ if(SOLARIS) endif() if(NOT CMAKE_CROSSCOMPILING) - add_compile_options(-static -flto) + add_compile_options(-static -flto ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS}) else() add_compile_options(-static) endif() @@ -33,8 +33,8 @@ if(NOT CMAKE_CROSSCOMPILING) set(CMAKE_C_ARCHIVE_FINISH "true") set(CMAKE_CXX_ARCHIVE_CREATE " qcs ") set(CMAKE_CXX_ARCHIVE_FINISH "true") - link_libraries( -flto -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive ) + link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} ) else() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" ) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS}" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") endif()