File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 4444 python : ' 3.6'
4545 args : >
4646 -DPYBIND11_FINDPYTHON=ON
47- -DCMAKE_CXX_FLAGS="-D_=1"
47+ -DPYBIND11_DEFINE_UNDERSCORE=ON
4848 - runs-on : windows-latest
4949 python : ' 3.6'
5050 args : >
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../tools")
8181option (PYBIND11_WERROR "Report all warnings as errors" OFF )
8282option (DOWNLOAD_EIGEN "Download EIGEN (requires CMake 3.11+)" OFF )
8383option (PYBIND11_CUDA_TESTS "Enable building CUDA tests (requires CMake 3.12+)" OFF )
84+ option (PYBIND11_DEFINE_UNDERSCORE "Define the underscore to make sure it is safe" OFF )
85+
8486set (PYBIND11_TEST_OVERRIDE
8587 ""
8688 CACHE STRING "Tests from ;-separated list of *.cpp files will be built instead of all tests" )
@@ -435,6 +437,9 @@ foreach(target ${test_targets})
435437 # Create the binding library
436438 pybind11_add_module(${target} THIN_LTO ${target} .cpp ${test_files} ${PYBIND11_HEADERS} )
437439 pybind11_enable_warnings(${target} )
440+ if (PYBIND11_DEFINE_UNDERSCORE)
441+ target_compile_definitions (${target} PUBLIC -D_=1)
442+ endif ()
438443
439444 if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR )
440445 get_property (
You can’t perform that action at this time.
0 commit comments