diff --git a/src/torch_atb/CMakeLists.txt b/src/torch_atb/CMakeLists.txt index f75429df72afee463a75ca2fbe4eaf4d7c7e3f04..85ac8d1528a98fa387210d255c8dd3bbbd420acd 100644 --- a/src/torch_atb/CMakeLists.txt +++ b/src/torch_atb/CMakeLists.txt @@ -11,7 +11,11 @@ file(GLOB_RECURSE pybind11_source_files "*.cpp") pybind11_add_module(_C ${pybind11_source_files}) set_target_properties(_C PROPERTIES OUTPUT_NAME "_C" SUFFIX ".so") -target_link_options(_C PRIVATE -Wno-odr -rdynamic -ldl -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--build-id=none -fexceptions) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(_C PRIVATE -Wno-odr) + target_link_options(_C PRIVATE -Wno-odr) +endif() +target_link_options(_C PRIVATE -rdynamic -ldl -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--build-id=none -fexceptions) target_link_libraries(_C PRIVATE torch_npu) target_include_directories(_C PRIVATE ${ATB_INCLUDE_DIR}) install(TARGETS _C DESTINATION ${CMAKE_SOURCE_DIR}/output/torch_atb) \ No newline at end of file