So I recently started a project that I'm developing in Linux. So I want to use CMake to build this project but I'm not sure on how CMake really works. I have looked at a few examples and tried using them but I have trouble wrapping my head around all of this.
My directory structure looks like this
//build stuff goes here
Where I want the file in the src directory to be built as a library.
The test directory to be built as an executable linking to the library from src
Anyone have any guidelines on what my CMakeLists.txt should look like?
First you'll have your project cmakelist (above your ProjectDir):
cmake_minimum_required(VERSION 2.8.3) #Or whatever version
project(ProjectName) #This is the 'solution' in visual studio or workspace in most other things
Then in your ProjectDir you would have another one:
add_library(ProjectDir SHARED #Remove shared if you want a static library
If you only ever plan on having one project you can just have 1 CMakeList with the above combined. I recommend keeping your include and source files seperate as this way it's easier to write an 'install' cmakelist.
Edited by CRYP7IK, 02 March 2014 - 05:18 PM.
To accomplish great things we must first dream, then visualize, then plan...believe... act! - Alfred A. Montapert
C# Programmer and Unity Developer at Well Placed Cactus.