Skip to content

Commit d25e91f

Browse files
authored
fix(cmake): warning about missing file (#5612)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 31e52b2 commit d25e91f

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ jobs:
182182
# More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF here.
183183
- name: Configure C++17
184184
run: >
185-
cmake -S . -B build2
185+
cmake -S . -B build2 -Werror=dev
186186
-DPYBIND11_WERROR=ON
187187
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
188188
-DPYBIND11_PYTEST_ARGS=-v

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ pybind11Targets.cmake
4444
/docs/_build/*
4545
.ipynb_checkpoints/
4646
tests/main.cpp
47+
CMakeUserPresents.json

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,17 @@ set(PYBIND11_HEADERS
129129
include/pybind11/detail/cpp_conduit.h
130130
include/pybind11/detail/descr.h
131131
include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
132+
include/pybind11/detail/exception_translation.h
132133
include/pybind11/detail/function_record_pyobject.h
133134
include/pybind11/detail/init.h
134135
include/pybind11/detail/internals.h
135136
include/pybind11/detail/native_enum_data.h
137+
include/pybind11/detail/pybind11_namespace_macros.h
136138
include/pybind11/detail/struct_smart_holder.h
137139
include/pybind11/detail/type_caster_base.h
138140
include/pybind11/detail/typeid.h
139141
include/pybind11/detail/using_smart_holder.h
140142
include/pybind11/detail/value_and_holder.h
141-
include/pybind11/detail/exception_translation.h
142143
include/pybind11/attr.h
143144
include/pybind11/buffer_info.h
144145
include/pybind11/cast.h

tests/CMakeLists.txt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -412,22 +412,26 @@ function(pybind11_enable_warnings target_name)
412412
endif()
413413

414414
if(PYBIND11_WERROR)
415-
if(MSVC)
416-
target_compile_options(${target_name} PRIVATE /WX)
417-
elseif(PYBIND11_CUDA_TESTS)
418-
target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings")
419-
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)")
420-
target_compile_options(${target_name} PRIVATE -Werror)
421-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
415+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
422416
if(CMAKE_CXX_STANDARD EQUAL 17) # See PR #3570
423417
target_compile_options(${target_name} PRIVATE -Wno-conversion)
424418
endif()
425-
target_compile_options(
426-
${target_name}
427-
PRIVATE
428-
-Werror-all
429-
# "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size"
430-
-diag-disable 11074,11076)
419+
# "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size"
420+
target_compile_options(${target_name} PRIVATE -diag-disable 11074,11076)
421+
endif()
422+
423+
if(CMAKE_VERSION VERSION_LESS "3.24")
424+
if(MSVC)
425+
target_compile_options(${target_name} PRIVATE /WX)
426+
elseif(PYBIND11_CUDA_TESTS)
427+
target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings")
428+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)")
429+
target_compile_options(${target_name} PRIVATE -Werror)
430+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
431+
target_compile_options(${target_name} PRIVATE -Werror-all)
432+
endif()
433+
else()
434+
set_target_properties(${target_name} PROPERTIES COMPILE_WARNING_AS_ERROR ON)
431435
endif()
432436
endif()
433437
endfunction()

0 commit comments

Comments
 (0)