cmake: use BUILD_SHARED_LIBS instead of ENABLE_STATIC to drive the shared object...
authorSamuel Martin <s.martin49@gmail.com>
Sun, 5 Oct 2014 12:18:52 +0000 (14:18 +0200)
committerSamuel Martin <s.martin49@gmail.com>
Mon, 1 Jun 2015 17:27:05 +0000 (19:27 +0200)
In case ENABLE_STATIC is still set on the CMake command line, this
change will makes CMake bail out becaus e this option is no longer
supported.

This patch makes taglib more compliant with the distro package framework
that uses the standards CMake options.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
CMakeLists.txt
INSTALL
examples/CMakeLists.txt

index 1c2bf39ef3bc5a482494aa15d9d5ed674be0c83d..6265bb2f438da7659bbc3477458b9babe4a8933b 100644 (file)
@@ -8,12 +8,12 @@ endif()
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 
-option(ENABLE_STATIC "Make static version of libtag"  OFF)
-if(ENABLE_STATIC)
+if(DEFINED ENABLE_STATIC)
+  message(FATAL_ERROR "This option is no longer available, use BUILD_SHARED_LIBS instead")
+endif()
+
+if(NOT BUILD_SHARED_LIBS)
   add_definitions(-DTAGLIB_STATIC)
-  set(BUILD_SHARED_LIBS OFF)
-else()
-  set(BUILD_SHARED_LIBS ON)
 endif()
 OPTION(ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically"  OFF)
 
diff --git a/INSTALL b/INSTALL
index 205b4d31b68d6ec50073d428dbd28e1a775f38a5..0fb4862f8afb7325f9a1953c6e9ef05c420d4f15 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -37,7 +37,7 @@ For a 10.6 Snow Leopard static library with both 32-bit and 64-bit code, use:
   cmake -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_OSX_DEPLOYMENT_TARGET=10.6 \
     -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-    -DENABLE_STATIC=ON \
+    -DBUILD_SHARED_LIBS=OFF \
     -DCMAKE_INSTALL_PREFIX="<folder you want to build to>"
 
 After 'make', and 'make install', add libtag.a to your XCode project, and add
@@ -139,9 +139,9 @@ The easiest way is at the Command Prompt.
        4. Select: Project Only
        5. Select: Build Only INSTALL
 
-To build a static library enable the following two options with CMake.
-  -DENABLE_STATIC=ON -DENABLE_STATIC_RUNTIME=ON
-  
+To build a static library, set the following two options with CMake.
+  -DBUILD_SHARED_LIBS=OFF -DENABLE_STATIC_RUNTIME=ON
+
 Including ENABLE_STATIC_RUNTIME=ON indicates you want TagLib built using the
 static runtime library, rather than the DLL form of the runtime.
 
index 17d4bd6bc8a693ab2da147a18b8cd3270b3cd9a6..b25d4ff688742c56f6e01a8cdd38bd49e830d213 100644 (file)
@@ -7,9 +7,9 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib
                     ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
                     ${CMAKE_CURRENT_SOURCE_DIR}/../bindings/c/  )
 
-if(ENABLE_STATIC)
+if(NOT BUILD_SHARED_LIBS)
     add_definitions(-DTAGLIB_STATIC)
-endif(ENABLE_STATIC)
+endif()
 
 ########### next target ###############