mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
fix: add option for _ check, only define on pybind11
This commit is contained in:
parent
666f13f061
commit
86817db488
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -44,7 +44,7 @@ jobs:
|
||||
python: '3.6'
|
||||
args: >
|
||||
-DPYBIND11_FINDPYTHON=ON
|
||||
-DCMAKE_CXX_FLAGS="-D_=1"
|
||||
-DPYBIND11_DEFINE_UNDERSCORE=ON
|
||||
- runs-on: windows-latest
|
||||
python: '3.6'
|
||||
args: >
|
||||
|
@ -81,6 +81,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../tools")
|
||||
option(PYBIND11_WERROR "Report all warnings as errors" OFF)
|
||||
option(DOWNLOAD_EIGEN "Download EIGEN (requires CMake 3.11+)" OFF)
|
||||
option(PYBIND11_CUDA_TESTS "Enable building CUDA tests (requires CMake 3.12+)" OFF)
|
||||
option(PYBIND11_DEFINE_UNDERSCORE "Define the underscore to make sure it is safe" OFF)
|
||||
|
||||
set(PYBIND11_TEST_OVERRIDE
|
||||
""
|
||||
CACHE STRING "Tests from ;-separated list of *.cpp files will be built instead of all tests")
|
||||
@ -435,6 +437,9 @@ foreach(target ${test_targets})
|
||||
# Create the binding library
|
||||
pybind11_add_module(${target} THIN_LTO ${target}.cpp ${test_files} ${PYBIND11_HEADERS})
|
||||
pybind11_enable_warnings(${target})
|
||||
if(PYBIND11_DEFINE_UNDERSCORE)
|
||||
target_compile_definitions(${target} PUBLIC -D_=1)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||
get_property(
|
||||
|
Loading…
Reference in New Issue
Block a user