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 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
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?