Last active
December 25, 2015 08:29
-
-
Save skyscribe/6947179 to your computer and use it in GitHub Desktop.
CMakeLists.txt for Boost template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdip -p bld; | |
cmake ../; | |
make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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