diff --git a/CMakeLists.txt b/CMakeLists.txt index 9723138a..be85c4cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,9 +19,6 @@ if(APPLE) set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.") endif() endif() -if(NOT BUILD_SHARED_LIBS) - add_definitions(-DTAGLIB_STATIC) -endif() option(ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically" OFF) option(ENABLE_CCACHE "Use ccache when building libtag" OFF) diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index 24bbc790..34c8993c 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -112,6 +112,9 @@ set_target_properties(tag_c PROPERTIES DEFINE_SYMBOL MAKE_TAGLIB_C_LIB INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR} ) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(tag_c PUBLIC TAGLIB_STATIC) +endif() if(TAGLIB_INSTALL_SUFFIX) if(BUILD_SHARED_LIBS) diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt index 3afd845f..89f988aa 100644 --- a/taglib/CMakeLists.txt +++ b/taglib/CMakeLists.txt @@ -461,6 +461,9 @@ set_target_properties(tag PROPERTIES INTERFACE_LINK_LIBRARIES "${ZLIB_INTERFACE_LINK_LIBRARIES}" PUBLIC_HEADER "${tag_HDRS}" ) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(tag PUBLIC TAGLIB_STATIC) +endif() if(VISIBILITY_HIDDEN) set_target_properties(tag PROPERTIES C_VISIBILITY_PRESET hidden) set_target_properties(tag PROPERTIES CXX_VISIBILITY_PRESET hidden)