mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
MSVC but not Clang: /MP (#2824)
On Windows, clang-cl does not understand /MP. ``` clang-cl: warning: argument unused during compilation: '/MP' [-Wunused-command-line-argument] ``` with Clang 10.0.0
This commit is contained in:
parent
e791ec4e27
commit
c78dfb69f2
@ -115,28 +115,32 @@ endif()
|
|||||||
|
|
||||||
add_library(pybind11::windows_extras IMPORTED INTERFACE ${optional_global})
|
add_library(pybind11::windows_extras IMPORTED INTERFACE ${optional_global})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC) # That's also clang-cl
|
||||||
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
|
# /bigobj is needed for bigger binding projects due to the limit to 64k
|
||||||
# needed for bigger binding projects due to the limit to 64k addressable sections
|
# addressable sections
|
||||||
set_property(
|
set_property(
|
||||||
TARGET pybind11::windows_extras
|
TARGET pybind11::windows_extras
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY INTERFACE_COMPILE_OPTIONS /bigobj)
|
PROPERTY INTERFACE_COMPILE_OPTIONS /bigobj)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.11)
|
# /MP enables multithreaded builds (relevant when there are many files) for MSVC
|
||||||
set_property(
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # no Clang no Intel
|
||||||
TARGET pybind11::windows_extras
|
if(CMAKE_VERSION VERSION_LESS 3.11)
|
||||||
APPEND
|
set_property(
|
||||||
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<NOT:$<CONFIG:Debug>>:/MP>)
|
TARGET pybind11::windows_extras
|
||||||
else()
|
APPEND
|
||||||
# Only set these options for C++ files. This is important so that, for
|
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<NOT:$<CONFIG:Debug>>:/MP>)
|
||||||
# instance, projects that include other types of source files like CUDA
|
else()
|
||||||
# .cu files don't get these options propagated to nvcc since that would
|
# Only set these options for C++ files. This is important so that, for
|
||||||
# cause the build to fail.
|
# instance, projects that include other types of source files like CUDA
|
||||||
set_property(
|
# .cu files don't get these options propagated to nvcc since that would
|
||||||
TARGET pybind11::windows_extras
|
# cause the build to fail.
|
||||||
APPEND
|
set_property(
|
||||||
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>)
|
TARGET pybind11::windows_extras
|
||||||
|
APPEND
|
||||||
|
PROPERTY INTERFACE_COMPILE_OPTIONS
|
||||||
|
$<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user