Skip to content

Instantly share code, notes, and snippets.

@matjam
Created June 10, 2020 03:24
Show Gist options
  • Save matjam/a3ebec6f789f148f6932edda02e9d5b4 to your computer and use it in GitHub Desktop.
Save matjam/a3ebec6f789f148f6932edda02e9d5b4 to your computer and use it in GitHub Desktop.
# CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
# install vcpkg into /usr/local/vcpkg or some other path; you just need to point to it.
# hardcode the path in the CMakeLists.txt because I'm a peasant.
set(CMAKE_TOOLCHAIN_FILE "/usr/local/vcpkg/scripts/buildsystems/vcpkg.cmake")
project(testapp
VERSION 0.1
DESCRIPTION "test"
LANGUAGES CXX)
# You'll need your source and header files in src/ naturally.
file(GLOB_RECURSE sources CONFIGURE_DEPENDS src/*.cpp src/*.hpp)
# This example uses the boost::filesystem stuff.
find_package(Boost REQUIRED COMPONENTS filesystem)
add_executable(testapp ${sources})
# recommended that you use modern C++.
set_property(TARGET testapp PROPERTY CXX_STANDARD 17)
# This links in Boost::filesystem but usually you don't need this step if
# you're using something that is header only.
target_link_libraries(testapp PRIVATE Boost::filesystem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment