summaryrefslogtreecommitdiff
path: root/README.cmake
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2009-05-12 18:49:13 +0200
committerJared Adams <jaxad0127@gmail.com>2009-05-12 10:59:39 -0600
commit97372f667c2fa31def9fc03de86bf22ae35e565f (patch)
tree651ba45cd2af8ca6be1f9257a1721c0fce05caaf /README.cmake
parent34489687667ba5622ad3ba109381ee4c39da24e5 (diff)
downloadmana-97372f667c2fa31def9fc03de86bf22ae35e565f.tar.gz
mana-97372f667c2fa31def9fc03de86bf22ae35e565f.tar.bz2
mana-97372f667c2fa31def9fc03de86bf22ae35e565f.tar.xz
mana-97372f667c2fa31def9fc03de86bf22ae35e565f.zip
Included a readme to describe most common cmake operations
Diffstat (limited to 'README.cmake')
-rw-r--r--README.cmake66
1 files changed, 66 insertions, 0 deletions
diff --git a/README.cmake b/README.cmake
new file mode 100644
index 00000000..5796a5c8
--- /dev/null
+++ b/README.cmake
@@ -0,0 +1,66 @@
+This readme explains the most common parameters to CMake needed for
+building tmw.
+
+Basic syntax
+------------
+
+cmake [options] <source directory>
+
+If you don't need any special options just change to the directory where
+you extracted the sources and do `cmake . && make'
+
+The syntax for setting variables to control CMakes behaviour is
+-D <variable>=<value>
+
+
+How do I...
+-----------
+
+- Use a custom install prefix (like --prefix on autoconf)?
+ CMAKE_INSTALL_PREFIX=/path/to/prefix
+- Create a debug build?
+ CMAKE_BUILD_TYPE=Debug .
+- Add additional package search directories?
+ CMAKE_PREFIX_PATH=/prefix/path
+- Add additional include search directories?
+ CMAKE_INCLUDE_PATH=/include/path
+
+For example, to build tmw to install in /opt/tmw, with libraries in
+/build/tmw/lib, and SDL-headers in /build/tmw/include/SDL you'd use
+the following command:
+
+cmake -D CMAKE_PREFIX_PATH=/build/tmw \
+ -D CMAKE_INCLUDE_PATH=/build/tmw/include/SDL \
+ -D CMAKE_INSTALL_PREFIX=/opt/tmw .
+
+
+Crosscompiling using CMake
+--------------------------
+
+The following example assumes you're doing a Windows-build from within a
+UNIX environement, using mingw32 installed in /build/mingw32.
+
+- create a toolchain-file describing your environement:
+$ cat /build/toolchain.cmake
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER i386-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER i386-mingw32-g++)
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /build/mingw32 /build/tmw-libs )
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+- set your PATH to include the bin-directory of your mingw32-installation:
+$ export PATH=/build/mingw32/bin:$PATH
+
+- configure the source tree for the build, using the toolchain file:
+$ cmake -DCMAKE_TOOLCHAIN_FILE=/build/toolchain.cmake .
+
+- use make for building the application
+