- [Requirements](#req) | 
	
	
	
		- [Getting library](#get) | 
	
	
	
		- [Build Process](#bld) | 
	
	
	
		- [Build Options](#opt) | 
	
	
	
		- [Examples](#examples) | 
	
	
	
		    - [POSIX Operating Systems](#posix) | 
	
	
	
		    - [Microsoft Windows](#win32) | 
	
	
	
		    - [Cross Compilation](#cross) | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		## <class id="req"></class>Requirements | 
	
	
	
		 | 
	
	
	
		In order to build CppCMS you need: | 
	
	
	
		 | 
	
	
	
		_Mandatory Requirements_ | 
	
	
	
		 | 
	
	
	
		- Modern C++ Compiler -- GCC, MSVC 9, Intel. See [supported compilers and platforms](/wikipp/en/page/cppcms_1x_platforms) | 
	
	
	
		- CMake 2.6 and above, 2.8.1 recommended. | 
	
	
	
		- ICU Library 3.6 and above. | 
	
	
	
		- Zlib library | 
	
	
	
		- PCRE library. | 
	
	
	
		- Python >=2.4 (but not 3) | 
	
	
	
		- _MSVC/Mingw only_: pthread-win32 library: | 
	
	
	
		 | 
	
	
	
		    - pthreadGC2.dll for MinGW | 
	
	
	
		    - pthreadVC2.dll for MSVC | 
	
	
	
		 | 
	
	
	
		_Recommended Dependencies_ | 
	
	
	
		 | 
	
	
	
		- gcrypt library -- for support of encrypted session cookies. | 
	
	
	
		-   ICU Library 3.6 and above -- support  | 
	
	
	
		    of advanced localization features. | 
	
	
	
		-   gcrypt or OpenSSL library -- for support  | 
	
	
	
		    of encrypted session cookies. | 
	
	
	
		 | 
	
	
	
		    If both available gcrypt would be used. | 
	
	
	
		 | 
	
	
	
		_Suggested_ | 
	
	
	
		 | 
	
	
	
		- iconv library (if libc does not provide iconv interface) | 
	
	
	
		 | 
	
	
	
		## <class id="get"></class>Getting library | 
	
	
	
		 | 
	
	
	
		Download the latest cppcms-0.x.x.tar.bz2 from [sourceforge](https://sourceforge.net/projects/cppcms/files/) and extract it: | 
	
	
	
		 | 
	
	
	
		    tar -xjf cppcms-0.99.1.tar.bz2 | 
	
	
	
		 | 
	
	
	
		If you want to get latest version | 
	
	
	
		You need Subversion to get the sources: | 
	
	
	
		 | 
	
	
	
		    svn co http://cppcms.svn.sourceforge.net/svnroot/cppcms/framework/branches/refactoring  cppcms   | 
	
	
	
		 | 
	
	
	
		And then extract the cppcms_boost.tar.bz2 (this step not needed for released files from Sourceforge) | 
	
	
	
		 | 
	
	
	
		    cd cppcms  | 
	
	
	
		    tar -xjf cppcms_boost.tar.bz2 | 
	
	
	
		 | 
	
	
	
		_Note:_ Under windows you may use 7zip in order to extract the file. | 
	
	
	
		 | 
	
	
	
		## <class id="bld"></class>Build Process | 
	
	
	
		 | 
	
	
	
		Go to the cppcms directory you created and create build directory and go to it: | 
	
	
	
		 | 
	
	
	
		    mkdir build | 
	
	
	
		    cd build | 
	
	
	
		 | 
	
	
	
		Now configure the library with CMake | 
	
	
	
		 | 
	
	
	
		    cmake .. | 
	
	
	
		 | 
	
	
	
		Or | 
	
	
	
		      | 
	
	
	
		    cmake various_build_options .. | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		Then run | 
	
	
	
		 | 
	
	
	
		    make | 
	
	
	
		    make test | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		## <class id="opt"></class>Build Options | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		- `-DDISABLE_STATIC=ON` -- disable building of static version of cppcms library | 
	
	
	
		- `-DDISABLE_SHARED=ON` -- disable building of shared version of cppcms library | 
	
	
	
		- `-DDISABLE_ICONV=ON` -- disable usage of iconv (ICU would be used instead) | 
	
	
	
		- `-DDISABLE_GCRYPT=ON` -- disable usage of gcrypt library. No support of encrypted session cookies would be available (only signed one) | 
	
	
	
		- `-DDISABLE_GCRYPT=ON` -- disable usage of gcrypt library. - `-DDISABLE_OPENSSL=ON` -- disable usage of OpenSSL. | 
	
	
	
		- `-DDISABLE_FCGI=ON` -- build without FastCGI Server API. | 
	
	
	
		- `-DDISABLE_SCGI=ON` -- build without SCGI Server API. | 
	
	
	
		- `-DDISABLE_HTTP=ON` -- build without internal HTTP server. | 
	
	
	
		 | 
	
	
	
		_Options for custom release:_ They would add "-c" suffix to the library name. The API and ABI of the library would not be compatible with standard builds and no ABI backward compatibility is provided. | 
	
	
	
		 | 
	
	
	
		- `-DDISABLE_ICU_LOCALIZATION=ON` -- do not use ICU for localization but rather C++ `std::locale` based localization -- many localization features would not be available, but it may be useful for embedded builds. | 
	
	
	
		- `-DDISABLE_ICU_LOCALE=ON` -- do not use ICU for localization but rather C++ `std::locale`, Windows API or POSIX API based localization -- many localization features would not be available, but it may be useful for embedded builds. | 
	
	
	
		 | 
	
	
	
		_Generic useful CMake options:_ | 
	
	
	
		 | 
	
	
	
		- `-DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel)` -- release type. RelWithDebInfo is default, unless using MSVC where Debug is default. | 
	
	
	
		 | 
	
	
	
		- `-DCMAKE_INCLUDE_PATH=/path/to/include` -- path to location of libraries headers, provide it in order to find libraries headers installed in non-standard locations. You almost always need to provide it under Windows. | 
	
	
	
		- `-DCMAKE_LIBRARY_PATH=/path/to/lib` -- path to location of libraries, provide it in order to find libraries installed in non-standard locations. You almost always need to provide it under Windows. | 
	
	
	
		- `-DCMAKE_INSTALL_PREFIX=/usr/local` -- Installation prefix (similar to autoconf --prefix). Defaults to /usr/local | 
	
	
	
		 | 
	
	
	
		## <class id="examples"></class>Examples | 
	
	
	
		 | 
	
	
	
		### <class id="posix"></class>POSIX Operating Systems | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		I assume that you are in a terminal in the build directory inside the CppCMS source directory. | 
	
	
	
		 | 
	
	
	
		Build under Linux, FreeBSD and Cygwin: | 
	
	
	
		 | 
	
	
	
		    cmake .. | 
	
	
	
		    make | 
	
	
	
		    make test  | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		Build under OpenSolaris with SunStudio | 
	
	
	
		 | 
	
	
	
		    cmake -DCMAKE_C_COMPILER=/usr/bin/suncc -DCMAKE_CXX_COMPILER=/usr/bin/sunCC .. | 
	
	
	
		    make | 
	
	
	
		    make test  | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		Build under OpenSolaris with GCC, where ICU installed in /opt/icu | 
	
	
	
		 | 
	
	
	
		    cmake -DCMAKE_INCLUDE_PATH=/opt/icu/include -DCMAKE_LIBRARY_PATH=/opt/icu/lib .. | 
	
	
	
		    make | 
	
	
	
		    make test  | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		### <class id="win32"></class>Mircosoft Windows | 
	
	
	
		 | 
	
	
	
		We assume that 3rd part libraries installed in `c:\3rd_part` and | 
	
	
	
		sources are placed in `d:\projects\cppcms` | 
	
	
	
		 | 
	
	
	
		_Note:_ You need to setup correct PATH variables in order | 
	
	
	
		to let system find all DLLs it needs. | 
	
	
	
		 | 
	
	
	
		Under cmd.exe: | 
	
	
	
		 | 
	
	
	
		    set PATH=c:\3rd_part\lib;%PATH% | 
	
	
	
		    set PATH=d:\projects\cppcms\build\booster;%PATH%  | 
	
	
	
		 | 
	
	
	
		Under bash: | 
	
	
	
		 | 
	
	
	
		    export PATH=/c/3rd_part/lib:"$PATH" | 
	
	
	
		    export PATH=/d/projects/cppcms/build/booster:"$PATH" | 
	
	
	
		 | 
	
	
	
		_MinGW Builds:_ | 
	
	
	
		 | 
	
	
	
		For mingw builds you also need to pass a path to the mingw's | 
	
	
	
		library directory, otherwise it may not find winsock | 
	
	
	
		library correctly. Assuming you have mingw installed | 
	
	
	
		in `c:\mingw` | 
	
	
	
		 | 
	
	
	
		Open MinGW Shell terminal | 
	
	
	
		 | 
	
	
	
		    cmake -G "MSYS Makefiles" -DCMAKE_INCLUDE_PATH=c:/3rd_part/include -DCMAKE_LIBRARY_PATH="c:/3rd_part/lib;c:/mingw/lib" -DCMAKE_INSTALL_PREFIX=c:/mingw .. | 
	
	
	
		    make | 
	
	
	
		    make test  | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		_MSVC Builds:_ | 
	
	
	
		 | 
	
	
	
		Open MSVC Shell terminal (All Programs > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Command Prompt) | 
	
	
	
		 | 
	
	
	
		 | 
	
	
	
		    cmake -G "NMake Makefiles" -DCMAKE_INCLUDE_PATH=c:/3rd_part/include -DCMAKE_LIBRARY_PATH=c:/3rd_part/lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/cppcms .. | 
	
	
	
		    nmake | 
	
	
	
		    nmake test  | 
	
	
	
		    nmake install | 
	
	
	
		 | 
	
	
	
		### <class id="cross"></class>Cross Compiling | 
	
	
	
		 | 
	
	
	
		The build is just ordinary CMake cross-compilation procedure. For more information read <http://www.cmake.org/Wiki/CMake_Cross_Compiling> | 
	
	
	
		 | 
	
	
	
		We would provide an example for ARM under Linux, without ICU. | 
	
	
	
		 | 
	
	
	
		Create ToolChain.cmake | 
	
	
	
		 | 
	
	
	
		    SET(CMAKE_SYSTEM_NAME Linux) | 
	
	
	
		    SET(CMAKE_C_COMPILER  /usr/bin/arm-linux-gnueabi-gcc) | 
	
	
	
		    SET(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabi-g++) | 
	
	
	
		    SET(CMAKE_FIND_ROOT_PATH  /usr/arm-linux-gnueabi) | 
	
	
	
		    SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | 
	
	
	
		    SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | 
	
	
	
		    SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | 
	
	
	
		 | 
	
	
	
		Configure | 
	
	
	
		 | 
	
	
	
		    cmake -DCMAKE_TOOLCHAIN_FILE=ToolChain.cmake -DDISABLE_ICU_LOCALIZATION=ON  -DCMAKE_ISTALL_PREFIX=/usr/arm-linux-eabi .. | 
	
	
	
		    make | 
	
	
	
		    make install | 
	
	
	
		 | 
	
	
	
		 |