Issue #1532: Incompatible config options, /MP vs /Gm for MSVC in DEBUG (#1533)

* Issue #1532: Incompatible config options, /MP vs /Gm for MSVC in DEBUG
This commit is contained in:
Rune Paamand 2018-10-25 01:35:33 +02:00 committed by Wenzel Jakob
parent c9b8933e9a
commit 06d021b6e4

View File

@ -209,15 +209,15 @@ function(pybind11_add_module target_name)
if(MSVC) if(MSVC)
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is # /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 # 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) 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() else()
# Only set these options for C++ files. This is important so that, for # Only set these options for C++ files. This is important so that, for
# instance, projects that include other types of source files like CUDA # instance, projects that include other types of source files like CUDA
# .cu files don't get these options propagated to nvcc since that would # .cu files don't get these options propagated to nvcc since that would
# cause the build to fail. # 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()
endif() endif()
endfunction() endfunction()