File tree 1 file changed +11
-1
lines changed
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)
156
156
# namespace; also turning it on for a pybind module compilation here avoids
157
157
# potential warnings or issues from having mixed hidden/non-hidden types.
158
158
set_target_properties (${target_name} PROPERTIES CXX_VISIBILITY_PRESET "hidden" )
159
+ set_target_properties (${target_name} PROPERTIES CUDA_VISIBILITY_PRESET "hidden" )
159
160
160
161
if (WIN32 OR CYGWIN )
161
162
# Link against the Python shared library on Windows
@@ -208,6 +209,15 @@ function(pybind11_add_module target_name)
208
209
if (MSVC )
209
210
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
210
211
# 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 ()
212
222
endif ()
213
223
endfunction ()
You can’t perform that action at this time.
0 commit comments