xref: /OK3568_Linux_fs/buildroot/package/gli/0001-Optional-building-tests.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 629fc81ce73114a5925484937df796467adbe8c7 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= <pereira.john94@gmail.com>
3Date: Fri, 22 Mar 2019 22:58:17 +0000
4Subject: [PATCH] Optional building tests
5
6[Retrieved from:
7https://github.com/g-truc/gli/commit/629fc81ce73114a5925484937df796467adbe8c7]
8Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
9---
10 CMakeLists.txt      | 1 +
11 test/CMakeLists.txt | 8 +++++---
12 2 files changed, 6 insertions(+), 3 deletions(-)
13
14diff --git a/CMakeLists.txt b/CMakeLists.txt
15index 6eb1a68b..bcff7ef0 100644
16--- a/CMakeLists.txt
17+++ b/CMakeLists.txt
18@@ -13,6 +13,7 @@ include(GNUInstallDirs)
19 include(CMakePackageConfigHelpers)
20
21 enable_testing()
22+option(GLI_TEST_ENABLE "Build unit tests" ON)
23
24 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
25 add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
26diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
27index 6b1d4826..e51a3181 100644
28--- a/test/CMakeLists.txt
29+++ b/test/CMakeLists.txt
30@@ -19,10 +19,12 @@ function(glmCreateTestGTC NAME)
31 	set(SAMPLE_NAME test-${NAME})
32 	add_executable(${SAMPLE_NAME} ${NAME}.cpp)
33 	target_link_libraries(${SAMPLE_NAME} gli)
34-	add_test(
35+	add_test(
36 		NAME ${SAMPLE_NAME}
37 		COMMAND $<TARGET_FILE:${SAMPLE_NAME}> )
38 endfunction()
39
40-add_subdirectory(bug)
41-add_subdirectory(core)
42+if(GLI_TEST_ENABLE)
43+	add_subdirectory(bug)
44+	add_subdirectory(core)
45+endif()
46