Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.41 KB

README.md

File metadata and controls

32 lines (22 loc) · 1.41 KB

#CMake

This is an example project in C++ to show how a project can be structured using CMake as a build-system. Read more about CMake at http://www.cmake.org/.

##Create project It is highly recommended to keep the CMake project files (generated by CMake) in a sub folder to the top level directory. This is because it makes it easier to distinguish between source and generated files and binaries. One way is to create a folder called "build" which is used in the following sections. ###Command-line

Changing directory to the build directory and runs CMake with the relative path to the top-level CMakeLists.txt file. Then builds the project using the system "make" command which uses the generated "Makefile".

$ cd build/
$ cmake ../ 
$ make

Execute the binary from the current directory

$ ../bin/Hello

It is also possible to generate Xcode (and many other project types), see "man cmake" for complete list.

$ cmake ../ -G Xcode

###GUI

  • Run the GUI and set the "Where is the source code" to the top-level directory.
  • Create "build" directory
  • Set the "Where to build the binaries" to the build folder
  • Run configure and choose the type of project (Visual Studio, Xcode, etc)
  • Run generate to create project files.
  • Open the project files and build the binaries

#Feedback Feel free to submit feedback, issues and feature requests. This is only a very simple example project which can be changed and expanded in many ways.