History: Building Your Projects With CMake
Preview of version: 10
- «
- »
|
This section is an introduction on how to use CMake to build your own projects and have them link against Ogre. For more detailed information about CMake, refer to the official CMake website: http://www.cmake.org |
Introduction
Table of contents
A Template
The following files are needed:
- CMakeLists.txt
- include/
- *.h
- src/
- *.cpp
Your CMakeLists.txt file
A sample is included below
Copy to clipboard
cmake_minimum_required(VERSION 2.6) PROJECT(ogre3dTest) set(CMAKE_MODULE_PATH /usr/local/lib/OGRE/cmake ) FIND_PACKAGE(OpenGL) FIND_PACKAGE(OGRE) FIND_PACKAGE(OIS) INCLUDE_DIRECTORIES( ${OpenGL_INCLUDE_DIR} ${OGRE_INCLUDE_DIRS} ${OIS_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include ) FILE(GLOB SRCS src/*.cpp) FILE(GLOB HDRS include/*.h) ADD_EXECUTABLE(ogre3dTest ${SRCS} ${HDRS} ) TARGET_LINK_LIBRARIES(ogre3dTest ${OpenGL_LIBRARIES} ${OIS_LIBRARIES} ${OGRE_LIBRARIES} )
Replace ogre3dTest with any name you want. CMAKE_MODULE_PATH points to where you installed the Ogre3D cmake modules. This usually happens when you run make install.
resources.cfg & plugins.cfg
You will also need these files. For more information see Setting Up An Application.