Skip to content

Commit

Permalink
Issue pybind#1532: Incompatible config options, /MP vs /Gm for MSVC i…
Browse files Browse the repository at this point in the history
…n DEBUG (pybind#1533)

* Issue pybind#1532: Incompatible config options, /MP vs /Gm for MSVC in DEBUG
  • Loading branch information
paamand authored and wjakob committed Oct 24, 2018
1 parent c9b8933 commit 06d021b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/pybind11Tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 06d021b

Please sign in to comment.