@@ -676,33 +676,28 @@ function(add_mlir_python_extension libname extname)
676
676
# Avoid some warnings from upstream nanobind.
677
677
# If a superproject set MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES, let
678
678
# the super project handle compile options as it wishes.
679
- set (nanobind_target "nanobind-static" )
680
- if (NOT TARGET ${nanobind_target} )
681
- # Get correct nanobind target name: nanobind-static-ft or something else
682
- # It is set by nanobind_add_module function according to the passed options
683
- get_property (all_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS )
684
-
685
- # Iterate over the list of targets
686
- foreach (target ${all_targets} )
687
- # Check if the target name matches the given string
688
- if ("${target} " MATCHES "nanobind-" )
689
- set (nanobind_target "${target} " )
690
- endif ()
691
- endforeach ()
692
-
693
- if (NOT TARGET ${nanobind_target} )
694
- message (FATAL_ERROR "Could not find nanobind target to set compile options to" )
695
- endif ()
696
- endif ()
697
- target_compile_options (${nanobind_target}
698
- PRIVATE
699
- -Wno-cast-qual
700
- -Wno-zero-length-array
701
- -Wno-nested-anon-types
702
- -Wno-c++98-compat-extra-semi
703
- -Wno-covered-switch-default
704
- ${eh_rtti_enable}
705
- )
679
+ get_property (NB_LIBRARY_TARGET_NAME TARGET ${libname} PROPERTY LINK_LIBRARIES )
680
+ target_compile_options (${NB_LIBRARY_TARGET_NAME}
681
+ PRIVATE
682
+ -Wall -Wextra -Wpedantic
683
+ -Wno-c++98-compat-extra-semi
684
+ -Wno-cast-qual
685
+ -Wno-covered-switch-default
686
+ -Wno-nested-anon-types
687
+ -Wno-unused-parameter
688
+ -Wno-zero-length-array
689
+ ${eh_rtti_enable} )
690
+
691
+ target_compile_options (${libname}
692
+ PRIVATE
693
+ -Wall -Wextra -Wpedantic
694
+ -Wno-c++98-compat-extra-semi
695
+ -Wno-cast-qual
696
+ -Wno-covered-switch-default
697
+ -Wno-nested-anon-types
698
+ -Wno-unused-parameter
699
+ -Wno-zero-length-array
700
+ ${eh_rtti_enable} )
706
701
endif ()
707
702
708
703
if (APPLE )
0 commit comments