# Include Meson project with CMake FetchContent

**URL:** https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985
**Category:** Code
**Created:** [August 26, 2021, 4:46pm UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985 "2021-08-26T16:46:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![junglie85](https://discourse.cmake.org/user_avatar/discourse.cmake.org/junglie85/32/1734_2.png) [@junglie85](https://discourse.cmake.org/u/junglie85)
#### Post date: [August 26, 2021, 4:46pm UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985/1 "2021-08-26T16:46:43Z")

</div>

I’m trying to move to using the bleeding branch, which comes with Meson build system instead of CMake. Does anyone have any advice on how to add this as a dependency using FetchContent? I’ve tried the following, but no luck:

```auto
FetchContent_Declare(criterion
        GIT_REPOSITORY https://github.com/Snaipe/Criterion.git
        GIT_TAG bleeding
        GIT_SUBMODULES_RECURSE TRUE
        CONFIGURE_COMMAND "meson build"
        BUILD_COMMAND "ninja -C build"
        )
FetchContent_MakeAvailable(criterion)

```

Please could someone suggest how to configure this?

---

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [August 26, 2021, 7:04pm UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985/2 "2021-08-26T19:04:46Z")

</div>

Do you need to build this project from source?

When using projects with alternative build systems it’s worth considering using pre-built libraries.

---

<div class="post-metadata">

### Author: ![junglie85](https://discourse.cmake.org/user_avatar/discourse.cmake.org/junglie85/32/1734_2.png) [@junglie85](https://discourse.cmake.org/u/junglie85)
#### Post date: [August 27, 2021, 6:55am UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985/3 "2021-08-27T06:55:28Z")

</div>

I’d prefer to make it available with the source of my project. It allows me to use different versions between projects.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [August 27, 2021, 11:15pm UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985/4 "2021-08-27T23:15:02Z")

</div>

FetchContent doesn’t support custom configure and build commands (this is explicitly mentioned in its docs). It can only bring in CMake projects to the main build. For dependencies that use a different build system, ExternalProject is what you should be using instead.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [August 30, 2021, 5:28pm UTC](https://discourse.cmake.org/t/include-meson-project-with-cmake-fetchcontent/3985/5 "2021-08-30T17:28:27Z")

</div>

Yes I think one would want to consider a superbuild-like structure to allow building and selecting version of the external library
