# Building static libraries with Fetchcontent

**URL:** https://discourse.cmake.org/t/building-static-libraries-with-fetchcontent/13207
**Category:** Code
**Created:** [December 15, 2024, 11:34am UTC](https://discourse.cmake.org/t/building-static-libraries-with-fetchcontent/13207 "2024-12-15T11:34:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![spacey-sooty](https://discourse.cmake.org/user_avatar/discourse.cmake.org/spacey-sooty/32/5196_2.png) [@spacey-sooty](https://discourse.cmake.org/u/spacey-sooty)
#### Post date: [December 15, 2024, 11:34am UTC](https://discourse.cmake.org/t/building-static-libraries-with-fetchcontent/13207/1 "2024-12-15T11:34:52Z")

</div>

I’m trying to build a dependency statically to repackage it with another build system. Is there any way for me to set this to build statically? I can only find shared libraries in `build/_deps/library-build/`

---

<div class="post-metadata">

### Author: ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)
#### Post date: [December 15, 2024, 11:42am UTC](https://discourse.cmake.org/t/building-static-libraries-with-fetchcontent/13207/2 "2024-12-15T11:42:02Z")

</div>

If that dependency project “hardcodes” the `SHARED` argument in [add\_library()](https://cmake.org/cmake/help/latest/command/add_library.html#command:add_library), then I reckon the only way to go about that is to patch their original `CMakeLists.txt`. If they don’t hardcode the library type, then perhaps they set the [BUILD\_SHARED\_LIBS](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html) (_or maybe you do?_).
