From 2d23e4ddba3a98dcd60c7a51a24ed2bbad746888 Mon Sep 17 00:00:00 2001 From: Juha Reunanen Date: Mon, 19 Dec 2016 17:07:43 +0200 Subject: [PATCH] Problem: Visual Studio linker errors resulting from mixed /MT and /MD settings Solution: don't set CUDA_PROPAGATE_HOST_FLAGS to OFF when using Visual Studio --- dlib/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index 7eae9ec88..8c0251986 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -510,7 +510,10 @@ if (NOT TARGET dlib) # -std=c++11 option if you let it propagate it to nvcc in some # cases. So instead we disable this and manually include # things from CMAKE_CXX_FLAGS in the CUDA_NVCC_FLAGS list below. - set(CUDA_PROPAGATE_HOST_FLAGS OFF) + if (!MSVC) + set(CUDA_PROPAGATE_HOST_FLAGS OFF) + endif() + # Grab all the -D flags from CMAKE_CXX_FLAGS so we can pass them # to nvcc. string(REGEX MATCHALL "-D[^ ]*" FLAGS_FOR_NVCC ${CMAKE_CXX_FLAGS})