From a38d2b299589c87e866195959e13f289e2fadca9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sun, 8 May 2011 15:57:34 +0200 Subject: [PATCH] Simplify static builds --- CMakeLists.txt | 6 ++++++ bindings/c/CMakeLists.txt | 7 +------ taglib/CMakeLists.txt | 7 +------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 928a3f5e..fb7c2892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt index 63dc84b8..2d9dafc4 100644 --- a/bindings/c/CMakeLists.txt +++ b/bindings/c/CMakeLists.txt @@ -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}") diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt index 8e7a3b64..d7274a89 100644 --- a/taglib/CMakeLists.txt +++ b/taglib/CMakeLists.txt @@ -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}) -- 2.40.0