Cocos2d-x project directory structure

All samples are in tests/ directory. If I am developing project outside of cocos2dx root directory I cannot compile it with cocos console. What is the proper CMakeLists.txt file to simply compile project? I am trying to compile it under Linux.

It crashing here:

if(ANDROID)
  set(PLATFORM_SRC proj.android/jni/hellocpp/main.cpp)
  set(RES_PREFIX "/Resources")
elseif(WINDOWS)
  set(PLATFORM_SRC proj.win32/main.cpp)
  set(RES_PREFIX "")
elseif(IOS)
  set(PLATFORM_SRC
    proj.ios/main.m
    proj.ios/AppController.mm
    proj.ios/RootViewController.mm
  )

I got “Unsupported platform” error because all those WINDOWS, ANDROID and IOS variables are not exist. It is probably because I have cocos2dx in other folder so I cannot see cocos2dx cmake files. How can I properly set this?

I am running cococs compile . -p linux within my project root directory.