libtcod CMake documentation
---------------------------

As opposed to the Quickstart, which is designed to get people using cmake quickly, this doucument is designed to help understand some of the design decisions make when writting CMakeLists.txt for libtcod.

First of all, the only good online documentation of cmake's syntax and variables can be found here: 
http://www.cmake.org/cmake/help/cmake-2-8-docs.html

With the exception of on Linux, libtcod uses dependencies inside the dependencies directory for headers and libraries. 

The current and prefered setup for using cmake involves what they call "out of tree" builds. This means that the source and the object files aren't intermingled. We do this by calling cmake from a different directory (cmake/release, cmake/debug, or cmake/vcproj) in our case (via the scripts).



Important build files
----------------------

cmake/generate-{target}
	These scripts are designed to call cmake with the correct argument for a given platform.

root/CMakeLists.txt:
	This is the first file processed by cmake. It sets up some baseline variable for each platform. It also sets the build to use the dependency directory or system library for SDL, PNG, ZLIB, and such. It then calls add_subdirectory() to process the src and samples directory.

src/CMakeLists.txt
	This builds libtcod, libtcodxx (under Linux), and libtcod-gui. Other than some workaround for each platform, it's straightforward.

samples/CMakeLists.txt
	This builds samples_c, samples_cpp, and hmtool. The only complicated action in this file is related to upx. upx is an program compresser, and is run upon the complated executable. In cmake, the best way to handle this I've found involves a "post-build step". The ADD_CUSTOM_COMMAND lines add this post-build step, which runs upx upon each target.