!43192 third_party lib name contain debug postfix "d" in msvc debug mode

Merge pull request !43192 from qiuzhongya/msvc_debug1
This commit is contained in:
i-robot 2022-09-30 01:05:20 +00:00 committed by Gitee
commit 842da0dec9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 26 additions and 1 deletions

View File

@ -3,6 +3,9 @@ if(BUILD_LITE)
set(glog_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(glog_CFLAGS "${CMAKE_C_FLAGS}")
set(glog_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
if(DEBUG_MODE)
set(glog_Debug ON)
endif()
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}")
@ -14,6 +17,9 @@ else()
if(MSVC)
# add "/EHsc", for vs2019 warning C4530 about glog
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private /EHsc")
if(DEBUG_MODE)
set(glog_Debug ON)
endif()
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")
endif()

View File

@ -2,6 +2,9 @@ if(MSVC)
set(opencv_CXXFLAGS "/DWIN32 /D_WINDOWS /W3 /GR /EHsc /std:c++17")
set(opencv_CFLAGS "${CMAKE_C_FLAGS}")
set(opencv_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
if(DEBUG_MODE)
set(opencv_Debug ON)
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")

View File

@ -6,6 +6,9 @@ if(BUILD_LITE)
set(protobuf_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
if(DEBUG_MODE)
set(protobuf_Debug ON)
endif()
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
@ -25,6 +28,9 @@ else()
set(protobuf_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
if(DEBUG_MODE)
set(opencv_Debug ON)
endif()
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")

View File

@ -1,6 +1,9 @@
if(MSVC)
set(tinyxml2_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(tinyxml2_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if(DEBUG_MODE)
set(tinyxml2_Debug ON)
endif()
else()
set(tinyxml2_CXXFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result")
set(tinyxml2_CFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2")

View File

@ -128,6 +128,9 @@ function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
foreach(_LIB_NAME ${ARGN})
set(_LIB_SEARCH_NAME ${_LIB_NAME})
if(MSVC AND ${pkg_name}_Debug)
set(_LIB_SEARCH_NAME ${_LIB_SEARCH_NAME}d)
endif()
set(_LIB_TYPE SHARED)
if(${pkg_name}_USE_STATIC_LIBS)
set(_LIB_SEARCH_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
@ -148,7 +151,11 @@ function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
add_library(${pkg_name}::${_LIB_NAME} ${_LIB_TYPE} IMPORTED GLOBAL)
if(WIN32 AND ${_LIB_TYPE} STREQUAL "SHARED")
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB_RELEASE ${${_LIB_NAME}_LIB})
if(DEBUG_MODE)
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB_DEBUG ${${_LIB_NAME}_LIB})
else()
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB_RELEASE ${${_LIB_NAME}_LIB})
endif()
else()
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${${_LIB_NAME}_LIB})
endif()