Skip to content

Instantly share code, notes, and snippets.

@skyscribe
Last active December 25, 2015 08:29
Show Gist options
  • Save skyscribe/6947179 to your computer and use it in GitHub Desktop.
Save skyscribe/6947179 to your computer and use it in GitHub Desktop.
CMakeLists.txt for Boost template
mkdip -p bld;
cmake ../;
make
cmake_minimum_required(VERSION 2.6)
set(Boost_DEBUG 1)
set(Boost_ADDITIONAL_VERSIONS "1.54" "1.54.0")
find_package( Boost 1.45.0 COMPONENTS
date_time
filesystem
regex
thread
system)
include_directories(${Boost_INCLUDE_DIRS})
#Add more source files here, each source will be built into one executable
set(src_list
test.cpp
)
foreach(src ${src_list})
string(REPLACE ".cpp" "" exeName ${src})
add_executable(${exeName} ${src})
target_link_libraries(${exeName} ${Boost_LIBRARIES})
endforeach()
#include <cstdlib>
#include <iostream>
#include <boost/thread.hpp>
using namespace std;
using namespace boost;
void test_func(){
cout << "This is a test func" << endl;
}
int main(int argc, const char *argv[])
{
boost::thread t(test_func);
t.join();
cout << "About to finish now!" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment