Skip to content

Commit

Permalink
Fix #667: Compiled TagLib framework for OS X fails at codesign.
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxi911 committed Dec 8, 2016
1 parent 36ccad2 commit b5115e3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
13 changes: 8 additions & 5 deletions CMakeLists.txt
Expand Up @@ -13,6 +13,14 @@ if(DEFINED ENABLE_STATIC)
endif()

option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if(APPLE)
option(BUILD_FRAMEWORK "Build an OS X framework" OFF)
if(BUILD_FRAMEWORK)
set(BUILD_SHARED_LIBS ON)
#set(CMAKE_MACOSX_RPATH 1)
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()
Expand Down Expand Up @@ -48,11 +56,6 @@ set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix")

if(APPLE)
option(BUILD_FRAMEWORK "Build an OS X framework" OFF)
set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
endif()

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
Expand Down
15 changes: 10 additions & 5 deletions ConfigureChecks.cmake
Expand Up @@ -54,11 +54,16 @@ check_cxx_source_compiles("
" HAVE_STD_ATOMIC)

if(NOT HAVE_STD_ATOMIC)
find_package(Boost COMPONENTS atomic)
if(Boost_ATOMIC_FOUND)
set(HAVE_BOOST_ATOMIC 1)
else()
set(HAVE_BOOST_ATOMIC 0)

# We will not find BOOST_ATOMIC on macOS when BUILD_FRAMEWORK is set, since we don't want to link
# to `libboost_atomic-mt.dylib` within `tag.framework`.
if(NOT BUILD_FRAMEWORK)
find_package(Boost COMPONENTS atomic)
if(Boost_ATOMIC_FOUND)
set(HAVE_BOOST_ATOMIC 1)
else()
set(HAVE_BOOST_ATOMIC 0)
endif()
endif()

if(NOT HAVE_BOOST_ATOMIC)
Expand Down
8 changes: 7 additions & 1 deletion taglib/CMakeLists.txt
Expand Up @@ -365,7 +365,13 @@ set_target_properties(tag PROPERTIES
PUBLIC_HEADER "${tag_HDRS}"
)
if(BUILD_FRAMEWORK)
set_target_properties(tag PROPERTIES FRAMEWORK TRUE)
unset(INSTALL_NAME_DIR)
set_target_properties(tag PROPERTIES
FRAMEWORK TRUE
MACOSX_RPATH 1
VERSION "A"
SOVERSION "A"
)
endif()

install(TARGETS tag
Expand Down

0 comments on commit b5115e3

Please sign in to comment.