From e63d40e39045d56520d19aef0552d206638642fa Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Sat, 23 Oct 2021 14:08:17 +0900 Subject: cmake: Add ENABLE_UNIT_TEST option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit check library가 없이 테스크 코드를 빌드하기 위한 옵션을 추가한다. --- CMakeLists.txt | 7 ++++++- test/CMakeLists.txt | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1