'FetchContent causes errors: Maximum recursion depth of 1000 exceeded

Trying to use FetchContent instead of ExternalProject but receive the following error:

[cmake] CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:147 (if): [cmake] Maximum recursion depth of 1000 exceeded

The following is output in the CMakeError.log but it isn't the root error:

Run Build Command(s):/usr/bin/ninja cmTC_0faae && [1/2] Building C object CMakeFiles/cmTC_0faae.dir/CheckFunctionExists.c.o [2/2] Linking C executable cmTC_0faae FAILED: cmTC_0faae : && /bin/x86_64-linux-gnu-gcc-9 -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_0faae.dir/CheckFunctionExists.c.o -o cmTC_0faae -lpthreads && : /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

Currently using CMake 3.20.0 in Ubuntu. Have tried multiple earlier versions of CMake as well and all have the same error.

I am building the CMake source using the following tutorial:

https://graspingtech.com/upgrade-cmake

Edit:

Full CMakeOutput.log - https://gist.github.com/rschiefer/599055460f231bc71984848ab7a6a302#file-cmakeoutput-log

CMake Output - https://gist.github.com/rschiefer/599055460f231bc71984848ab7a6a302#file-cmake-output



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source