From 39cbea3f711228de9e6d78e589c7a72a6222e77b Mon Sep 17 00:00:00 2001 From: Davis King Date: Wed, 5 Apr 2017 20:02:26 -0400 Subject: [PATCH] Fixed cmake so openmp is handled properly in visual studio. The change yesterday messed it up and effectively disabled cuda in visual studio. This fixes that. --- dlib/CMakeLists.txt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index cb54eb1d6..b0a382c33 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -579,21 +579,18 @@ if (NOT TARGET dlib) # Intel MKL, hasn't already decided what to use. This is because # it makes the MKL bug out if you link to another openmp lib other # than Intel's when you use the MKL. - if (NOT openmp_libarires) - if (MSVC) - set(openmp_libarires "") + if (NOT openmp_libarires AND NOT MSVC) + find_package(OpenMP) + if (OPENMP_FOUND) + set(openmp_libarires ${OpenMP_CXX_FLAGS}) else() - find_package(OpenMP) - if (OPENMP_FOUND) - set(openmp_libarires ${OpenMP_CXX_FLAGS}) - else() - message(STATUS "*** Didn't find OpenMP, which is required to use CUDA. ***") - endif() + message(STATUS "*** Didn't find OpenMP, which is required to use CUDA. ***") + set(CUDA_FOUND 0) endif() endif() endif() - if (CUDA_FOUND AND cudnn AND cudnn_include AND COMPILER_CAN_DO_CPP_11 AND cuda_test_compile_worked AND cudnn_test_compile_worked AND openmp_libarires) + if (CUDA_FOUND AND cudnn AND cudnn_include AND COMPILER_CAN_DO_CPP_11 AND cuda_test_compile_worked AND cudnn_test_compile_worked) set(source_files ${source_files} dnn/cuda_dlib.cu dnn/cudnn_dlibapi.cpp