Skip to content

Instantly share code, notes, and snippets.

@philip-goh
Created October 12, 2012 18:09
Show Gist options
  • Save philip-goh/3880608 to your computer and use it in GitHub Desktop.
Save philip-goh/3880608 to your computer and use it in GitHub Desktop.
A basic cmake template that creates a minimal project
cmake_minimum_required(VERSION 2.6)
#Create an executable called Minimal that depends on minimal.cpp. Additional source files
#should be space separated.
add_executable(Minimal minimal.cpp)
project(Minimal)
#Tell the compiler to link to the static runtime
add_definitions(-static)
#Define preprocessor macro to get boost::threads working on Windows
add_definitions(-DBOOST_THREAD_USE_LIB)
#Look for the Boost package. If CMake fails to find Boost, it's very likely that you
#have not set the CMAKE_PREFIX_PATH environment variable.
find_package(Boost COMPONENTS thread system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(Minimal ${Boost_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment