History: Building Your Projects With CMake
Source of version: 10
- «
- »
Copy to clipboard
{BOX(width="100%",class="Layout_box9")}{SPLIT(colsize=10%|70%)}{IMG(src="img/wiki_up/Libraries.png",imalign="left",link="Building Your Projects With CMake",title="Building Your Projects With CMake")}{IMG}
---
{DIV(class="bigBold")}((Building Your Projects With CMake)){DIV}
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]
{SPLIT}{BOX}
!!Introduction
{maketoc}
!!A Template
The following files are needed:
* CMakeLists.txt
* include/
** *.h
* src/
** *.cpp
!!Your CMakeLists.txt file
A sample is included below
{CODE(wrap="1",colors="cmake")}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}
){CODE}
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)).