-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
Problem description
The cmake compile options for pybind11 currently adds a /bigobj option if MSVC is used, as can be seen here:
pybind11/tools/pybind11Common.cmake
Line 99 in 1c636f4
| PROPERTY INTERFACE_COMPILE_OPTIONS /bigobj) |
This is problematic if the language is in anything other than C++, which in my case was CUDA. The nvcc compiler does not recognize /bigobj (or at least I think this is what happens) and therefore raises an error:
[Nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified]
There is a very similar issue raised here, which details a bug concerning /MP:
#1532 (comment)
There are a lot of similar bugs if you care to google, and the consensus (whenever there is one) seems to be that /MP and /bigobj are the culprits. I personally have solved this problem by simply changing the line to, but I'm not certain whether this is the best fix:
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/bigobj>>)
Reproducible example code
No response