support projects outside of Cocos directory (cocos3-alpha)

Hi,

I don’t know if this topic was already discussed if so, accept my apologises.

I’ve updated a little template/multi-platform-cpp/CMakeLists.txt to reuse environment variable COCOS2D_ROOT.

My idea is to easily append a new release of Cocos on jenkins (I’ve already made it with cocos 2.2) with a matrix project, of course it requires to call cmake to refresh Makefile.

Is it ok or may I miss something else .

diff -u template/multi-platform-cpp/CMakeLists.txt /mnt/perso/progs/cocos3/TestV1/CMakeLists.txt 
--- template/multi-platform-cpp/CMakeLists.txt  2013-11-16 20:30:24.000000000 +0100
+++ /mnt/perso/progs/cocos3/TestV1/CMakeLists.txt   2014-01-06 15:33:06.316490912 +0100
@@ -3,7 +3,14 @@
 set(APP_NAME HelloCpp)
 project (${APP_NAME})

-include(../../build/BuildHelpers.CMakeLists.txt)
+SET( COCOS2D_ROOT $ENV{COCOS2D_ROOT} )
+if(COCOS2D_ROOT)
+  message("Using external COCOS")
+else(COCOS2D_ROOT)
+  set(COCOS2D_ROOT ../..)
+endif(COCOS2D_ROOT)
+
+include(${COCOS2D_ROOT}/build/BuildHelpers.CMakeLists.txt)

 option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
 option(USE_BOX2D "Use box2d for physics library" OFF)
@@ -45,8 +52,6 @@
   Classes/HelloWorldScene.cpp
 )

-set(COCOS2D_ROOT ${CMAKE_SOURCE_DIR}/../..)
-
 include_directories(
   ${COCOS2D_ROOT}
   ${COCOS2D_ROOT}/cocos

PS: I think it may also be applied on templates for lua ( no CMakeLists.txt found for js ? )