# FetchContent\_Declare not recognized

**URL:** https://discourse.cmake.org/t/fetchcontent-declare-not-recognized/443
**Category:** Code
**Created:** [December 30, 2019, 11:52am UTC](https://discourse.cmake.org/t/fetchcontent-declare-not-recognized/443 "2019-12-30T11:52:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adamvm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/adamvm/32/269_2.png) [@adamvm](https://discourse.cmake.org/u/adamvm)
#### Post date: [December 30, 2019, 11:52am UTC](https://discourse.cmake.org/t/fetchcontent-declare-not-recognized/443/1 "2019-12-30T11:52:20Z")

</div>

Hello,

I added gtest based on : [https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome#4-cmake-allows-easy-external-project-download-and-incorporation](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome#4-cmake-allows-easy-external-project-download-and-incorporation) so head of my CMakeLists.txt looks:

cmake\_minimum\_required(VERSION 3.11)  
project(hello)

FetchContent\_Declare(  
googletest  
GIT\_REPOSITORY [https://github.com/google/googletest.git](https://github.com/google/googletest.git)  
GIT\_TAG master  
)

FetchContent\_GetProperties(googletest)  
if (NOT googletest\_POPULATED)  
FetchContent\_Populate(googletest)  
add\_subdirectory(${googletest\_SOURCE\_DIR} ${googletest\_BINARY\_DIR})  
endif ()

In system I have CMake 3.13 so minimum version for this function is met (\>=3.11)

but when I run cmake … I got:

CMake Error at CMakeLists.txt:4 (FetchContent\_Declare):  
Unknown CMake command “FetchContent\_Declare”.

I’v tried on local system (win+CLion+WSL) and in travis-ci pipeline (Ubuntu/bionic) where I added CMake from sources (3.15)

What I’m doing wrong?

---

<div class="post-metadata">

### Author: ![Florian\_Chevassu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/florian_chevassu/32/99_2.png) [@Florian\_Chevassu](https://discourse.cmake.org/u/Florian_Chevassu)
#### Post date: [December 30, 2019, 12:06pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-not-recognized/443/2 "2019-12-30T12:06:24Z")

</div>

`FetchContent` is a CMake module. This means that it is not available in CMake by default, you need to _include_ it using `include(FetchContent)`. See the [examples](https://cmake.org/cmake/help/latest/module/FetchContent.html#examples) for more details.

---

<div class="post-metadata">

### Author: ![adamvm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/adamvm/32/269_2.png) [@adamvm](https://discourse.cmake.org/u/adamvm)
#### Post date: [December 30, 2019, 1:48pm UTC](https://discourse.cmake.org/t/fetchcontent-declare-not-recognized/443/3 "2019-12-30T13:48:59Z")

</div>

Works, thank you
