From a4381e1e4b2e07bfc5ecb73feab345ed8394fc04 Mon Sep 17 00:00:00 2001 From: Soumith Chintala Date: Fri, 14 Jul 2017 20:27:20 +0000 Subject: [PATCH] Static linking against libstdc++ in Binary Build mode --- lib/THCUNN/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/THCUNN/CMakeLists.txt b/lib/THCUNN/CMakeLists.txt index d4777bfa..6047d974 100644 --- a/lib/THCUNN/CMakeLists.txt +++ b/lib/THCUNN/CMakeLists.txt @@ -29,6 +29,11 @@ IF(NOT CUDA_FOUND) FIND_PACKAGE(CUDA 6.5 REQUIRED) ENDIF() +IF ($ENV{TH_BINARY_BUILD}) + MESSAGE(STATUS "TH_BINARY_BUILD detected. Statically linking libstdc++") + SET(CMAKE_CXX_FLAGS "-static-libstdc++ ${CMAKE_CXX_FLAGS}") +ENDIF() + # Detect CUDA architecture and get best NVCC flags IF(NOT COMMAND CUDA_SELECT_NVCC_ARCH_FLAGS OR MSVC) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/select_compute_arch.cmake)