CUDA_PROPAGATE_HOST_FLAGS=OFF in FindCUDA.cmake for try_compile tests (#1048)

Set `CUDA_PROPAGATE_HOST_FLAGS=OFF` in FindCUDA.cmake to avoid duplicate flag errors in nvcc that can occur when host flag forwarding is enabled and `-std=c++11` is set in `CMAKE_CXX_FLAGS` in the operative toolchain.
```
# Override the FindCUDA.cmake setting to avoid duplication of host flags if using a toolchain:
option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" OFF)
```
This commit is contained in:
David Hirvonen 2018-01-04 14:17:00 -05:00 committed by Davis E. King
parent f4853053e8
commit 75961ed1ac
2 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,8 @@ project(cuda_test)
include_directories(../../dnn)
add_definitions(-DDLIB_USE_CUDA)
# Override the FindCUDA.cmake setting to avoid duplication of host flags if using a toolchain:
option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" OFF)
find_package(CUDA 7.5 REQUIRED)
set(CUDA_HOST_COMPILATION_CPP ON)
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__;-D_MWAITXINTRIN_H_INCLUDED;-D_FORCE_INLINES")

View File

@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 2.8.12)
project(cudnn_test)
include(../use_cpp_11.cmake)
# Override the FindCUDA.cmake setting to avoid duplication of host flags if using a toolchain:
option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" OFF)
find_package(CUDA 7.5 REQUIRED)
set(CUDA_HOST_COMPILATION_CPP ON)
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__")