main.cpp
#include <iostream> #include <boost/shared_ptr.hpp> #include <boost/filesystem.hpp> int main(int argc, char *argv[]) { std::cout << "Hello Third Party Include!" << std::endl; // use a shared ptr boost::shared_ptr<int> isp(new int(4)); // trivial use of boost filesystem boost::filesystem::path path = "/usr/share/cmake/modules"; if(path.is_relative()) { std::cout << "Path is relative" << std::endl; } else { std::cout << "Path is not relative" << std::endl; } return 0; } |
CMakeLists.txt
cmake_minimum_required(VERSION 3.5) # Set the project name project (third_party_include) # find a boost install with the libraries filesystem and system find_package(Boost 1.46.1 REQUIRED COMPONENTS filesystem system) # check if boost was found if(Boost_FOUND) message ("boost found") else() message (FATAL_ERROR "Cannot find Boost") endif() # Add an executable add_executable(third_party_include main.cpp) # link against the boost libraries target_link_libraries( third_party_include PRIVATE Boost::filesystem ) |
mkdir build
cd build
cmake ..
make
[Reference]
'Languages > C++' 카테고리의 다른 글
CMakeLists.txt (0) | 2022.05.24 |
---|