summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2021-10-12 16:15:14 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2021-10-12 16:15:14 +0900
commit49cd5a2694ee70fcaac95fec8d4ad592047f9c07 (patch)
tree1e567bd36d82e25982cc2f52824a050c9907b710
parentdab127b85d1b4c88a1a729b1cd6f9000ab25eb77 (diff)
downloadlibhangul-49cd5a2694ee70fcaac95fec8d4ad592047f9c07.tar.gz
cmake: Add BUILD_SHARED_LIBS option
사용자가 Shared와 Static 빌드를 선택할 수 있게 BUILD_SHARED_LIBS 옵션을 추가한다. ENABLE_EXTERNAL_KEYBOARDS 옵션이 ON 일때에만 expat을 찾아도 되므로 조건 처리한다. 추가로 find_package()를 사용한다. 패키지를 찾을 때에는 include()보다 나을 것 같다.
-rw-r--r--CMakeLists.txt7
-rw-r--r--data/keyboards/CMakeLists.txt2
-rw-r--r--hangul/CMakeLists.txt13
-rw-r--r--po/CMakeLists.txt2
-rw-r--r--test/CMakeLists.txt2
5 files changed, 14 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b31d0e4..2307e55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,8 +25,13 @@ set(LIBHANGUL_SOVERSION_MAJOR 1)
set(LIBHANGUL_SOVERSION_MINOR 0)
set(LIBHANGUL_SOVERSION_PATCH 1)
+option(BUILD_SHARED_LIBS
+ "Enable/Disable shared library build."
+ ON
+)
+
option(ENABLE_EXTERNAL_KEYBOARDS
- "enable external keyboard xml file loading feature"
+ "Enable/Disable external keyboard xml file loading feature."
ON
)
diff --git a/data/keyboards/CMakeLists.txt b/data/keyboards/CMakeLists.txt
index 6c94c18..fea4951 100644
--- a/data/keyboards/CMakeLists.txt
+++ b/data/keyboards/CMakeLists.txt
@@ -18,7 +18,7 @@
cmake_minimum_required(VERSION 3.0)
#include(GNUInstallDirs)
-include(FindGettext)
+find_package(Gettext)
set(keyboard_file_list
hangul-keyboard-2.xml
diff --git a/hangul/CMakeLists.txt b/hangul/CMakeLists.txt
index aa6e27e..93f7fb4 100644
--- a/hangul/CMakeLists.txt
+++ b/hangul/CMakeLists.txt
@@ -17,14 +17,11 @@
cmake_minimum_required(VERSION 3.0)
-include(FindPkgConfig)
-include(FindEXPAT)
include(GNUInstallDirs)
-option(ENABLE_EXTERNAL_KEYBOARDS
- "enable external keyboard xml file loading feature"
- ON
-)
+if(ENABLE_EXTERNAL_KEYBOARDS)
+ find_package(EXPAT)
+endif()
set(hangul_PUBLIC_HEADERS
hangul.h
@@ -37,7 +34,7 @@ set(hangul_PRIVATE_HEADERS
hanjacompatible.h
)
-add_library(hangul SHARED
+add_library(hangul
${hangul_PUBLIC_HEADERS}
${hangul_PRIVATE_HEADERS}
hangulctype.c
@@ -53,7 +50,7 @@ target_compile_definitions(hangul
PRIVATE -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\"
)
-if (ENABLE_EXTERNAL_KEYBOARDS)
+if(ENABLE_EXTERNAL_KEYBOARDS)
target_compile_definitions(hangul
PRIVATE -DENABLE_EXTERNAL_KEYBOARDS=1
)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 82e26d4..ffa968b 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -17,7 +17,7 @@
cmake_minimum_required(VERSION 3.0)
-include(FindGettext)
+find_package(Gettext)
include(GNUInstallDirs)
file(READ LINGUAS LINGUAS)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 433baf9..52415bf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -17,7 +17,7 @@
cmake_minimum_required(VERSION 3.0)
-include(FindPkgConfig)
+find_package(PkgConfig)
add_executable(test-hangul
hangul.c