Simplify static builds

This commit is contained in:
Lukáš Lalinský 2011-05-08 15:57:34 +02:00
parent b5b8387aee
commit a38d2b2995
3 changed files with 8 additions and 12 deletions

View File

@ -3,6 +3,12 @@ project(taglib)
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
option(ENABLE_STATIC "Make static version of libtag" OFF)
if(ENABLE_STATIC)
add_definitions(-DTAGLIB_STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
option(BUILD_TESTS "Build the test suite" OFF)
option(BUILD_EXAMPLES "Build the examples" OFF)

View File

@ -18,12 +18,7 @@ include_directories(
set(tag_c_HDRS tag_c.h)
if(ENABLE_STATIC)
add_library(tag_c STATIC tag_c.cpp ${tag_c_HDRS})
set_target_properties(tag_c PROPERTIES COMPILE_DEFINITIONS TAGLIB_STATIC)
else()
add_library(tag_c SHARED tag_c.cpp ${tag_c_HDRS})
endif()
add_library(tag_c tag_c.cpp ${tag_c_HDRS})
target_link_libraries(tag_c tag)
set_target_properties(tag_c PROPERTIES PUBLIC_HEADER "${tag_c_HDRS}")

View File

@ -260,12 +260,7 @@ if(WITH_MP4)
set(tag_LIB_SRCS ${tag_LIB_SRCS} ${mp4_SRCS})
endif()
if(ENABLE_STATIC)
add_library(tag STATIC ${tag_LIB_SRCS} ${tag_HDRS})
set_target_properties(tag PROPERTIES COMPILE_DEFINITIONS TAGLIB_STATIC)
else()
add_library(tag SHARED ${tag_LIB_SRCS} ${tag_HDRS})
endif()
add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
if(ZLIB_FOUND)
target_link_libraries(tag ${ZLIB_LIBRARIES})