Skip to content

Commit 72789e7

Browse files
Removed /Zi from gtest (openvinotoolkit#22866) (openvinotoolkit#22898)
### Details: - There is no need to keep `/Zi` at all, because OV will propagate all its flags to gtest ### Details: - Ported openvinotoolkit#22866
1 parent 29bb557 commit 72789e7

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

thirdparty/gtest/CMakeLists.txt

+5-10
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,13 @@ _ov_gtest_filter_install_interface(gmock gmock)
3939
_ov_gtest_filter_install_interface(gmock_main gmock)
4040

4141
foreach(target gtest gtest_main gmock gmock_main)
42-
# If we have specified /Z7 option, remove -Zi option which comes from gtest
43-
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
44-
get_target_property(_target_cxx_flags ${target} COMPILE_OPTIONS)
42+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
43+
get_target_property(_target_cxx_flags ${target} COMPILE_FLAGS)
4544
if(_target_cxx_flags)
46-
if(CMAKE_CXX_FLAGS_DEBUG MATCHES ".+/Z7.+" OR CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES ".+/Z7.+")
47-
string(REPLACE "-Zi" " " _target_cxx_flags ${_target_cxx_flags})
48-
message(STATUS "Removing -Zi flag from target " ${target})
49-
set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
50-
endif()
45+
string(REPLACE "-Zi" " " _target_cxx_flags ${_target_cxx_flags})
46+
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${_target_cxx_flags}")
5147
endif()
52-
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" OR
53-
CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
48+
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
5449
target_compile_options(${target} PRIVATE -Wno-undef)
5550
if(CMAKE_COMPILER_IS_GNUCXX)
5651
target_compile_options(${target} PRIVATE -Wno-deprecated-copy)

0 commit comments

Comments
 (0)