File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ function(pybind11_add_module target_name)
156156 # namespace; also turning it on for a pybind module compilation here avoids
157157 # potential warnings or issues from having mixed hidden/non-hidden types.
158158 set_target_properties (${target_name} PROPERTIES CXX_VISIBILITY_PRESET "hidden" )
159+ set_target_properties (${target_name} PROPERTIES CUDA_VISIBILITY_PRESET "hidden" )
159160
160161 if (WIN32 OR CYGWIN )
161162 # Link against the Python shared library on Windows
@@ -208,6 +209,15 @@ function(pybind11_add_module target_name)
208209 if (MSVC )
209210 # /MP enables multithreaded builds (relevant when there are many files), /bigobj is
210211 # needed for bigger binding projects due to the limit to 64k addressable sections
211- target_compile_options (${target_name} PRIVATE /MP /bigobj)
212+ set (msvc_extra_options /MP /bigobj)
213+ if (CMAKE_VERSION VERSION_LESS 3.11)
214+ target_compile_options (${target_name} PRIVATE ${msvc_extra_options} )
215+ else ()
216+ # Only set these options for C++ files. This is important so that, for
217+ # instance, projects that include other types of source files like CUDA
218+ # .cu files don't get these options propagated to nvcc since that would
219+ # cause the build to fail.
220+ target_compile_options (${target_name} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${msvc_extra_options} >)
221+ endif ()
212222 endif ()
213223endfunction ()
You can’t perform that action at this time.
0 commit comments