Skip to content

Commit e73517d

Browse files
committed
CMake targets with TAGLIB_STATIC compile definition (#1277)
1 parent 6563cea commit e73517d

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ if(APPLE)
1919
set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
2020
endif()
2121
endif()
22-
if(NOT BUILD_SHARED_LIBS)
23-
add_definitions(-DTAGLIB_STATIC)
24-
endif()
2522
option(ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically" OFF)
2623

2724
option(ENABLE_CCACHE "Use ccache when building libtag" OFF)

bindings/c/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ set_target_properties(tag_c PROPERTIES
112112
DEFINE_SYMBOL MAKE_TAGLIB_C_LIB
113113
INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}
114114
)
115+
if(NOT BUILD_SHARED_LIBS)
116+
target_compile_definitions(tag_c PUBLIC TAGLIB_STATIC)
117+
endif()
115118

116119
if(TAGLIB_INSTALL_SUFFIX)
117120
if(BUILD_SHARED_LIBS)

taglib/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ set_target_properties(tag PROPERTIES
461461
INTERFACE_LINK_LIBRARIES "${ZLIB_INTERFACE_LINK_LIBRARIES}"
462462
PUBLIC_HEADER "${tag_HDRS}"
463463
)
464+
if(NOT BUILD_SHARED_LIBS)
465+
target_compile_definitions(tag PUBLIC TAGLIB_STATIC)
466+
endif()
464467
if(VISIBILITY_HIDDEN)
465468
set_target_properties(tag PROPERTIES C_VISIBILITY_PRESET hidden)
466469
set_target_properties(tag PROPERTIES CXX_VISIBILITY_PRESET hidden)

0 commit comments

Comments
 (0)