Static compilation of taglib_c / wchar_t setting

Lars Wehmeyer Lars.Wehmeyer at gmx.de
Fri Oct 2 13:28:28 CEST 2009


Hi all,

we believe we have found a minor issue in both the CMakeLists.txt and in
tag_c.cpp which prevents taglib_c from being built as a static library
by simply setting ENABLE_STATIC. Please review the patches below. They
appear to be working for both Windows and Linux.


Also, when using a statically compiled taglib lbrary in conjunction with
boost stuff and wide characters using Visual Studio 2005, we got linker
  errors. They are caused bsy a define in the top-level CMakeLists.txt:

add_definitions(/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
/Zc:wchar_t-)

It seems the changed default behavior of VS2005 to have wchar_t
activated leads to an incompatibility with the precompiled boost
libraries we are using. Maybe this should go somewhere in the FAQ
(couldn't find any mention of this issue)-

Keep up the good work!

Matthias Eichner
Lars Wehmeyer

----------------------------------------------------------------------

--- taglib-1.6/bindings/c/CMakeLists.txt	2009-09-08 10:52:57.000000000 +0200
+++ NEW/taglib-1.6/bindings/c/CMakeLists.txt	2009-10-02
11:36:46.000000000 +0200
@@ -18,9 +18,11 @@
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc )
  ########### next target ###############

-ADD_LIBRARY(tag_c SHARED tag_c.cpp)
  if(ENABLE_STATIC)
+    ADD_LIBRARY(tag_c STATIC tag_c.cpp)
      set_target_properties(tag_c PROPERTIES COMPILE_DEFINITIONS
TAGLIB_STATIC)
+else(ENABLE_STATIC)
+    ADD_LIBRARY(tag_c SHARED tag_c.cpp)
  endif(ENABLE_STATIC)

  TARGET_LINK_LIBRARIES(tag_c  tag )

----------------------------------------------------------------------

--- taglib-1.6/bindings/c/tag_c.h	2008-11-12 09:17:11.000000000 +0100
+++ NEW/taglib-1.6/bindings/c/tag_c.h	2009-10-02 11:35:11.000000000 +0200
@@ -29,7 +29,7 @@
  extern "C" {
  #endif

-#if defined(_WIN32) || defined(_WIN64)
+#if !defined(TAGLIB_STATIC) && (defined(_WIN32) || defined(_WIN64))
  #ifdef MAKE_TAGLIB_C_LIB
  #define TAGLIB_C_EXPORT __declspec(dllexport)
  #else

----------------------------------------------------------------------




More information about the taglib-devel mailing list