Skip to content

CMake target should include TAGLIB_STATIC compile definition #1277

@wo80

Description

@wo80

I am using TagLib as a static library with Visual Studio using CMake with

find_package(TagLib CONFIG)

This works well, but I still have to remember to manually set the TAGLIB_STATIC compile definition. I think instead of having

taglib/CMakeLists.txt

Lines 22 to 24 in 6563cea

if(NOT BUILD_SHARED_LIBS)
add_definitions(-DTAGLIB_STATIC)
endif()

in your CMakeLists.txt, it should be

if(NOT BUILD_SHARED_LIBS)
  target_compile_definitions(tag PUBLIC TAGLIB_STATIC)
endif()

This should also put the definition in the installed taglib-targets.cmake file, so that when imported, the project using TagLib automatically has the correct compile definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions