From fdb0c8758a54a929dca054f4630812b5d6d617b3 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 8 Oct 2008 14:19:01 -0400 Subject: BUG: Fix issue #7533. Revise fix for issue #7058 to use pragma comment libs in the source file rather than using TARGET_LINK_LIBRARIES in CMakeLists.txt because of the complex ifdef logic used in correct copies of comdef.h. --- Source/CMakeLists.txt | 13 ------------- Source/cmCallVisualStudioMacro.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c194c42..516e208 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -302,19 +302,6 @@ IF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) TARGET_LINK_LIBRARIES(CMakeLib rpcrt4) ENDIF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) -# With the Microsoft compiler (for _bstr_t support used from -# cmCallVisualStudioMacro) we need the comsupp lib. Needed when -# _MSC_VER and HAVE_COMDEF_H are defined... -# -IF(MSVC) - IF(MSVC60) - # comsuppd did not yet exist in VS6 - TARGET_LINK_LIBRARIES(CMakeLib comsupp) - ELSE(MSVC60) - TARGET_LINK_LIBRARIES(CMakeLib optimized comsupp debug comsuppd) - ENDIF(MSVC60) -ENDIF(MSVC) - # # CTestLib # diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index 2aefd20..0837108 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -36,6 +36,31 @@ static bool LogErrorsAsMessages; //---------------------------------------------------------------------------- +// Copied from a correct comdef.h to avoid problems with deficient versions +// of comdef.h that exist in the wild... Fixes issue #7533. +// +#if ( _MSC_VER >= 1300 ) +// VS7 and later: +#ifdef _NATIVE_WCHAR_T_DEFINED +# ifdef _DEBUG +# pragma comment(lib, "comsuppwd.lib") +# else +# pragma comment(lib, "comsuppw.lib") +# endif +#else +# ifdef _DEBUG +# pragma comment(lib, "comsuppd.lib") +# else +# pragma comment(lib, "comsupp.lib") +# endif +#endif +#else +// VS6 only had comsupp.lib: +# pragma comment(lib, "comsupp.lib") +#endif + + +//---------------------------------------------------------------------------- ///! Use ReportHRESULT to make a cmSystemTools::Message after calling ///! a COM method that may have failed. #define ReportHRESULT(hr, context) \ -- cgit v0.12