Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shouldn't assign value of $CUDA_FOUND to $WITH_GPU #17

Closed
wangkuiyi opened this issue Jun 21, 2018 · 1 comment
Closed

Shouldn't assign value of $CUDA_FOUND to $WITH_GPU #17

wangkuiyi opened this issue Jun 21, 2018 · 1 comment

Comments

@wangkuiyi
Copy link
Collaborator

wangkuiyi commented Jun 21, 2018

The following line has a bug

if(NOT CMAKE_CROSSCOMPILING)
find_package(CUDA QUIET)
endif(NOT CMAKE_CROSSCOMPILING)
option(WITH_GPU "Compile Source Code with NVIDIA GPU" ${CUDA_FOUND})

as it assigns the value of ${CUDA_FOUND}, which could be TRUE or FALSE, to ${WITH_GPU}, which should be either ON or OFF.

This causes a bug on my macOS with CMake 3.11 that even if CMake found CUDA and set CUDA_FOUND to be TRUE, WITH_GPU will be OFF, because CMake doesn't think TRUE as ON.

@gangliao
Copy link
Owner

gangliao commented Jun 22, 2018

@wangkuiyi
We can add a new variable to hold the info for ${CUDA_FOUND}.

set(bazel_cuda_found OFF)
if (${CUDA_FOUND})
   set(bazel_cuda_found ON)
endif(${CUDA_FOUND})

option(WITH_GPU     "Compile Source Code with NVIDIA GPU"     ${bazel_cuda_found}) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants