# Is BUILD\_SHARED\_LIBS an implicit option without being declared as a project option?

**URL:** https://discourse.cmake.org/t/is-build-shared-libs-an-implicit-option-without-being-declared-as-a-project-option/6308
**Category:** Code
**Created:** [August 19, 2022, 11:11pm UTC](https://discourse.cmake.org/t/is-build-shared-libs-an-implicit-option-without-being-declared-as-a-project-option/6308 "2022-08-19T23:11:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![specious](https://discourse.cmake.org/user_avatar/discourse.cmake.org/specious/32/2695_2.png) [@specious](https://discourse.cmake.org/u/specious)
#### Post date: [August 19, 2022, 11:11pm UTC](https://discourse.cmake.org/t/is-build-shared-libs-an-implicit-option-without-being-declared-as-a-project-option/6308/1 "2022-08-19T23:11:17Z")

</div>

According to the [docs](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) and this [tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html), it appears that the recommendation is to declare `BUILD_SHARED_LIBS` as an `option()`.

What precisely is the working status of this flag when it is not declared by the project? It seems like it works and defaults to `OFF`.

---

<div class="post-metadata">

### Author: ![specious](https://discourse.cmake.org/user_avatar/discourse.cmake.org/specious/32/2695_2.png) [@specious](https://discourse.cmake.org/u/specious)
#### Post date: [August 19, 2022, 11:28pm UTC](https://discourse.cmake.org/t/is-build-shared-libs-an-implicit-option-without-being-declared-as-a-project-option/6308/2 "2022-08-19T23:28:11Z")

</div>

It looks like there’s no problem setting it from the command line with `-DBUILD_SHARED_LIBS=ON`, and if not set then it is implicitly an empty string value (meaning the condition is off).
