Skip to content

JayTwoLab/conan-cmake-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conan CMake Sample

Korean README

This project demonstrates how to use Conan and CMake to build a simple C++ application with Boost dependencies.

Project Structure

  • src/main.cpp: Minimal example using Boost.Asio.
  • CMakeLists.txt: CMake build configuration.
  • conanfile.txt: Conan package requirements and generator settings.

Requirements

  • CMake >= 3.21
  • Conan >= 2.x
  • A C++17 compatible compiler (e.g., MSVC, GCC, Clang)

Dependencies

  • Boost 1.83.0 (via Conan)

Building the Project

1. Install Dependencies with Conan

conan install . -of build --build=missing

Or, for a specific profile (e.g., MSVC):

conan install . -of build-msvc --build=missing -pr:h msvc_release -pr:b msvc_release

2. Configure the Project with CMake

cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake

Or for MSVC profile:

cmake -S . -B build-msvc -DCMAKE_TOOLCHAIN_FILE=build-msvc/conan_toolchain.cmake

3. Build

cmake --build build --config Release

Or for MSVC profile:

cmake --build build-msvc --config Release

Example Output

When you run the resulting executable, you should see:

Boost.Asio OK

Notes

  • To use Boost as header-only (to reduce build time/size), uncomment and use the following option in conanfile.txt:
    # boost/*:header_only=True
    
  • The CMake configuration automatically links the correct Boost target depending on your environment.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

conan, cmake exmaple 🇰🇷 코난 씨메이크 예제

Resources

License

Stars

Watchers

Forks

Packages

No packages published