From 3f85183c88852c9332089b6f1c192f51986fb7bd Mon Sep 17 00:00:00 2001 From: Stewart Miles Date: Wed, 10 Sep 2014 16:01:13 -0700 Subject: [PATCH] Added option to disable build of tests and samples. Added FLATBUFFERS_BUILD_TESTS option which can be used to disable the build of flatbuffers tests and samples. Tested: Verified tests and samples are no longer built on Linux when FLATBUFFERS_BUILD_TESTS=OFF. Change-Id: Ic23ab827849ba2c4481de9ca86adc1ab8e6b828c --- CMakeLists.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57fdba0..2a6323c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(FlatBuffers) # NOTE: Code coverage only works on Linux & OSX. option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF) +option(FLATBUFFERS_BUILD_TESTS "Enable the build of tests and samples." ON) set(FlatBuffers_Compiler_SRCS include/flatbuffers/flatbuffers.h @@ -68,14 +69,18 @@ endif() include_directories(include) add_executable(flatc ${FlatBuffers_Compiler_SRCS}) -add_executable(flattests ${FlatBuffers_Tests_SRCS}) -add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS}) -add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS}) +if(FLATBUFFERS_BUILD_TESTS) + add_executable(flattests ${FlatBuffers_Tests_SRCS}) + add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS}) + add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS}) +endif() install(DIRECTORY include/flatbuffers DESTINATION include) install(TARGETS flatc DESTINATION bin) -add_test(NAME flattest - CONFIGURATIONS Debug - WORKING_DIRECTORY tests - COMMAND flattests) +if(FLATBUFFERS_BUILD_TESTS) + add_test(NAME flattest + CONFIGURATIONS Debug + WORKING_DIRECTORY tests + COMMAND flattests) +endif() -- 2.7.4