# building libtorrent with cmake

**URL:** https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602
**Category:** Usage
**Tags:** os:windows
**Created:** [March 4, 2023, 6:47am UTC](https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602 "2023-03-04T06:47:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![a-sajjad72](https://discourse.cmake.org/user_avatar/discourse.cmake.org/a-sajjad72/32/3227_2.png) [@a-sajjad72](https://discourse.cmake.org/u/a-sajjad72)
#### Post date: [March 4, 2023, 6:47am UTC](https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602/1 "2023-03-04T06:47:07Z")

</div>

i am building libtorrent with cmake, documentation [here](http://libtorrent.org/building.html#building-with-cmake). i need help in specifying multiple build options.

command i am using

> `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -G Ninja ..`

Other build options are:  
`BUILD_SHARED_LIBS` Defaults ON. Builds libtorrent as a shared library.  
`static_runtime` Defaults OFF. Link libtorrent statically against the runtime libraries.  
`build_tests` Defaults OFF. Also build the libtorrent tests.  
`build_examples` Defaults OFF. Also build the examples in the examples directory.  
`build_tools` Defaults OFF. Also build the tools in the tools directory.  
`python-bindings` Defaults OFF. Also build the python bindings in bindings/python directory.  
`encryption` Defaults ON. Support trackers and bittorrent over TLS, and obfuscated bittorrent connections.  
Options are set on the cmake command line with the -D option or later on using ccmake or cmake-gui applications. cmake run outputs a summary of all available options and their current values.

> Options are set on the cmake command line with the -D option

but when specify `-D` it shows error

> cmake -DCMAKE\_BUILD\_TYPE=Release -DCMAKE\_CXX\_STANDARD=14 -G Ninja … -D “build\_examples”  
> CMake Error: Parse error in command line argument: build\_examples

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 7, 2023, 7:05pm UTC](https://discourse.cmake.org/t/building-libtorrent-with-cmake/7602/2 "2023-03-07T19:05:12Z")

</div>

You need to give a value. So it should be `-Dbuild_examples=ON`, not `-D build_examples`.
