From 6500f09931bb0f348ccc6860b43e1f5f9db6be2d Mon Sep 17 00:00:00 2001 From: "Ricardo Constantino (:RiCON)" Date: Wed, 16 Mar 2016 14:25:06 +0000 Subject: [PATCH] CMake: Allow building static-only builds Add stdc++ to static libs in pkg-config --- CMakeLists.txt | 6 +++++- src/CMakeLists.txt | 1 - uchardet.pc.in | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 223b53f..325f763 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,8 +63,12 @@ set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale) ######## Configuration -option(BUILD_STATIC "Build static library" +option(BUILD_SHARED_LIBS "Build shared library and link executable against it" ON) +if (BUILD_SHARED_LIBS) + option(BUILD_STATIC "Build static library" + ON) +endif (BUILD_SHARED_LIBS) configure_file( uchardet.pc.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39f460c..32e62c2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,6 @@ add_definitions( add_library( ${UCHARDET_TARGET} - SHARED ${UCHARDET_SOURCES} ) diff --git a/uchardet.pc.in b/uchardet.pc.in index 660a401..8f646fd 100644 --- a/uchardet.pc.in +++ b/uchardet.pc.in @@ -8,4 +8,5 @@ Description: An encoding detector library ported from Mozilla Version: @UCHARDET_VERSION@ Requires: Libs: -L${libdir} -luchardet +Libs.private: -lstdc++ Cflags: -I${includedir}/uchardet