Skip to content

Commit b1e4a16

Browse files
deflinhecminggo
authored and
minggo
committed
add build test option for cmake (#19608)
* add build test option for cmake * configure build test option for cmake
1 parent 1b1a1a4 commit b1e4a16

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: CMakeLists.txt

+10-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ AssureOutOfSourceBuilds()
4141
# works before build libcocos2d
4242
include(CocosBuildSet)
4343

44+
# build options
45+
option(BUILD_TESTS "Build tests" ON)
46+
4447
# default tests include lua, js test project, so we set those option on to build libs
4548
set(BUILD_LUA_LIBS ON)
4649
set(BUILD_JS_LIBS ON)
@@ -50,8 +53,10 @@ add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
5053
# prevent tests project to build "cocos2d-x/cocos" again
5154
set(BUILD_ENGINE_DONE ON)
5255
# add engine all tests project
53-
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test)
54-
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests)
55-
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests)
56-
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test)
57-
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test)
56+
if (BUILD_TESTS)
57+
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test)
58+
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests)
59+
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests)
60+
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test)
61+
add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test)
62+
endif()

0 commit comments

Comments
 (0)