# Using Conan

If you're not using the most recent Linux, you will have an older version of boost.

Conan can solve that, (or, in cases where you want to use a newer boost then what is provided).

## Using Conan to find things

This searches conan for any/all boost versions.

```conan search boost --remote=conancenter```

What settings are there for the boost library that I might want to use?

```conan search boost/1.71.0@```

## Setup for TWProxy

Here's how:

### conanfile.txt

Create conanfile with:

```
[requires]
boost/1.71.0

[generators]
cmake
```

### CMakeLists.txt

Below the DEBUG or RELEASE section add:

```
add_definitions("-std=c++11")
set(Boost_USE_STATIC_LIBS        ON)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
```

Below the C++ Standard section comment out:

```
# FIND_PACKAGE( Boost 1.60 COMPONENTS program_options log_setup log REQUIRED )
# INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
```

Change all the target_link_libraries lines, replacing Boost_LIBRARIES with CONAN_LIBS:

```
# target_link_libraries(test-galaxy gtest_main ${Boost_LIBRARIES} yaml-cpp)
target_link_libraries(test-galaxy gtest_main ${CONAN_LIBS} yaml-cpp)
# TARGET_LINK_LIBRARIES( twproxy ${Boost_LIBRARIES} pthread yaml-cpp)
TARGET_LINK_LIBRARIES( twproxy ${CONAN_LIBS} pthread yaml-cpp)
```

### Conan install

The --settings isn't needed if you change the global settings with:

```conan profile update settings.compiler.libcxx=libstdc++11 default```


```
cd build
conan install --settings compiler.libcxx="libstdc++11" ../
```

or

```
cd build
conan install ..
```

A normal build should work just fine.