cocos2d/cocos2d-x — pull request #9300 by KingDuckZ (2014-11-27 22:05:44+00:00)
Title: Fix for when cocos is included as a cmake subproject.

Projects seeking to include cocos2d-x as a subproject can now define COCOS2D_ROOT to enable this behaviour. For example my master cmake file:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(game)

set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Werror -O0 -D_DEBUG -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -g -Wall -Werror -O0 -D_DEBUG -DCOCOS2D_DEBUG=1")
set(CMAKE_C_FLAGS_RELEASE "-Wall -Werror -O3 -D_DEBUG -DCOCOS2D_DEBUG=0")
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -Wall -Werror -O3 -D_DEBUG -DCOCOS2D_DEBUG=0")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/cocos2d-x/cmake/Modules")

set(ENV{COCOS_CONSOLE_ROOT} "${CMAKE_SOURCE_DIR}/lib/cocos2d-x/tools/cocos2d-console/bin")
set(ENV{COCOS_X_ROOT} "${CMAKE_SOURCE_DIR}/lib/cocos2d-x")
set(COCOS2D_ROOT "${CMAKE_SOURCE_DIR}/lib/cocos2d-x")

add_subdirectory(lib/cocos2d-x)
add_subdirectory(src/game)