[mlir][py] Don't use a CMake iteration to find nanobind target to suppress warnings (NFC) (#143863)
Following approach suggested by @hpkfft.
This commit is contained in:
parent
cccb82e552
commit
cd91d0fff9
@ -676,33 +676,28 @@ function(add_mlir_python_extension libname extname)
|
|||||||
# Avoid some warnings from upstream nanobind.
|
# Avoid some warnings from upstream nanobind.
|
||||||
# If a superproject set MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES, let
|
# If a superproject set MLIR_DISABLE_CONFIGURE_PYTHON_DEV_PACKAGES, let
|
||||||
# the super project handle compile options as it wishes.
|
# the super project handle compile options as it wishes.
|
||||||
set(nanobind_target "nanobind-static")
|
get_property(NB_LIBRARY_TARGET_NAME TARGET ${libname} PROPERTY LINK_LIBRARIES)
|
||||||
if (NOT TARGET ${nanobind_target})
|
target_compile_options(${NB_LIBRARY_TARGET_NAME}
|
||||||
# Get correct nanobind target name: nanobind-static-ft or something else
|
PRIVATE
|
||||||
# It is set by nanobind_add_module function according to the passed options
|
-Wall -Wextra -Wpedantic
|
||||||
get_property(all_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
|
-Wno-c++98-compat-extra-semi
|
||||||
|
-Wno-cast-qual
|
||||||
|
-Wno-covered-switch-default
|
||||||
|
-Wno-nested-anon-types
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wno-zero-length-array
|
||||||
|
${eh_rtti_enable})
|
||||||
|
|
||||||
# Iterate over the list of targets
|
target_compile_options(${libname}
|
||||||
foreach(target ${all_targets})
|
PRIVATE
|
||||||
# Check if the target name matches the given string
|
-Wall -Wextra -Wpedantic
|
||||||
if("${target}" MATCHES "nanobind-")
|
-Wno-c++98-compat-extra-semi
|
||||||
set(nanobind_target "${target}")
|
-Wno-cast-qual
|
||||||
endif()
|
-Wno-covered-switch-default
|
||||||
endforeach()
|
-Wno-nested-anon-types
|
||||||
|
-Wno-unused-parameter
|
||||||
if (NOT TARGET ${nanobind_target})
|
-Wno-zero-length-array
|
||||||
message(FATAL_ERROR "Could not find nanobind target to set compile options to")
|
${eh_rtti_enable})
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
target_compile_options(${nanobind_target}
|
|
||||||
PRIVATE
|
|
||||||
-Wno-cast-qual
|
|
||||||
-Wno-zero-length-array
|
|
||||||
-Wno-nested-anon-types
|
|
||||||
-Wno-c++98-compat-extra-semi
|
|
||||||
-Wno-covered-switch-default
|
|
||||||
${eh_rtti_enable}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user