summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2021-10-23 14:08:17 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2021-10-23 14:44:14 +0900
commite63d40e39045d56520d19aef0552d206638642fa (patch)
tree69659cb5a269d181d10e62db90b03fc5af44307e
parent8de22bfb0bc1d80e0da3aebbfc59c57e3425a1a6 (diff)
downloadlibhangul-cmake.tar.gz
cmake: Add ENABLE_UNIT_TEST optioncmake
check library가 없이 테스크 코드를 빌드하기 위한 옵션을 추가한다.
-rw-r--r--CMakeLists.txt7
-rw-r--r--test/CMakeLists.txt4
2 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2307e55..8adbdb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,11 @@ option(ENABLE_EXTERNAL_KEYBOARDS
ON
)
+option(ENABLE_UNIT_TEST
+ "Enable/Disable unit test."
+ ON
+)
+
include(CTest)
include(GNUInstallDirs)
@@ -48,7 +53,7 @@ add_subdirectory(tools)
add_subdirectory(po)
if(BUILD_TESTING)
- add_subdirectory(test)
+ add_subdirectory(test EXCLUDE_FROM_ALL)
endif()
include(CMakePackageConfigHelpers)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6e21f2f..a82e4d4 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,6 +36,8 @@ target_compile_definitions(test-hanja PRIVATE
target_link_libraries(test-hanja LINK_PRIVATE hangul)
# unit test
+if(ENABLE_UNIT_TEST)
+
pkg_check_modules(CHECK REQUIRED check)
add_executable(unittest
@@ -52,3 +54,5 @@ target_link_libraries(unittest PRIVATE hangul ${CHECK_LDFLAGS})
add_test(NAME unittest
COMMAND ./unittest
)
+
+endif() # ENABLE_UNIT_TEST)