mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
* Issue #1532: Incompatible config options, /MP vs /Gm for MSVC in DEBUG
This commit is contained in:
parent
c9b8933e9a
commit
06d021b6e4
@ -209,15 +209,15 @@ function(pybind11_add_module target_name)
|
||||
if(MSVC)
|
||||
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
|
||||
# needed for bigger binding projects due to the limit to 64k addressable sections
|
||||
set(msvc_extra_options /MP /bigobj)
|
||||
target_compile_options(${target_name} PRIVATE /bigobj)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.11)
|
||||
target_compile_options(${target_name} PRIVATE ${msvc_extra_options})
|
||||
target_compile_options(${target_name} PRIVATE $<$<NOT:$<CONFIG:Debug>>:/MP>)
|
||||
else()
|
||||
# Only set these options for C++ files. This is important so that, for
|
||||
# instance, projects that include other types of source files like CUDA
|
||||
# .cu files don't get these options propagated to nvcc since that would
|
||||
# cause the build to fail.
|
||||
target_compile_options(${target_name} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${msvc_extra_options}>)
|
||||
target_compile_options(${target_name} PRIVATE $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user