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
This commit is contained in:
Stewart Miles 2014-09-10 16:01:13 -07:00
parent 354aad4bc5
commit 3f85183c88
1 changed files with 12 additions and 7 deletions

View File

@ -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()