Fix CMake scripts so projects using CUDA .cu files build correctly. #1441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes a few minor changes to the CMake scripts so projects using CUDA .cu files build correctly. For example, CMake allows you to use CUDA files in a python extension module with a CMakeLists.txt such as:
That works fine on Linux with the current pybind11 cmake scripts. However, it fails on OS X and windows with Visual Studio. On OS X it fails because of incorrect link visibility settings for the CUDA code. In Visual Studio it fails because the current CMake scripts end up passing /MP and /bigobj to nvcc, but nvcc doesn't understand those options and so it errors out.
This PR fixes those issues. Allowing CMake projects such as the one shown above to compile on all three platforms.
And as an aside, pybind11 is great. I switched dlib to it from boost python and my life is much improved :)