cocos2d/cocos2d-x — pull request #9177 by vovkasm (2014-11-20 19:04:24+00:00)
Title: Cmake unify usage of prebuilt libraries

Cmake build system: unify usage of prebuilt libraries

This patch unify usage of external libs while building process. And should simplify future development. Also some small fixes that I was need to include because can’t test without them.

1. By default use our prebuilt libs. (exception is mingw for witch we don’t have prebuilt libs, so try to find system installed pkgs)
2. Allow to set `-DUSE_PREBUILT_LIBS=NO` to force finding external deps in system (as other soft with cmake Find* modules)
3. Add some missing deps and link errors.
4. Build luasocket on Linux and Mingw
5. Build test executables on Mingw
6. Situation with unzip. For now we have modified minizip sources from [official zlib contrib/minizip folder](https://github.com/madler/zlib/tree/master/contrib/minizip), most systems package unmodified version from this sources. But MSYS2 package more modern «version» from [github.com/nmoinvaz/minizip repo](https://github.com/nmoinvaz/minizip) (in quotes, because repo contains no branches or tags, so no real released versions). So… we use own sources mostly with one exception - mingw, where MSYS2 package fresh version.
7. protobuf. We use own sources, because version packaged with other systems can be incompatible with generated protobuf interfaces (witch itself has not committed sources). (I mean file: `cocos/editor-support/cocostudio/CSParseBinary.pb.cc`)
8. Connect new audio engine to build.
9. On Win, test executable not search Resources folder, so install resources in same folder, as executable.

This can be tested on:
* MSYS2. mingw32: build success, tests runnable.
* MSYS2. mingw64: build success, tests runnable.
* Arch Linux 64. USE_PREBUILT_LIBS=YES. success, runnable (also not all deps was prebuilt, zlib not prebuilded, fontconfig not prebuilded)
* Arch Linux 64. USE_PREBUILT_LIBS=NO. success, runnable.
* Mac. USE_PREBUILT_LIBS=YES. success, runnable.
* Mac. USE_PREBUILT_LIBS=NO. (with all deps installed from Homebrew). success, runnable.

Lua tests currently build, but runs for me only on some configs (but this can be fixed in next patches).