FetchContent: make enter directory messages silent with verbose FetchContent_Populate
using cmake version 3.20.1 with Unix Makefile generator verbose output for FetchContent_Populate
is inconsistent.
Expected build output:
-- Populating moderncmake
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build/moderncmake-subbuild
[ 11%] Performing update step for 'moderncmake-populate'
HEAD is now at dea7d40
[ 22%] No patch step for 'moderncmake-populate'
[ 33%] No configure step for 'moderncmake-populate'
[ 44%] No build step for 'moderncmake-populate'
[ 55%] No install step for 'moderncmake-populate'
[ 66%] No test step for 'moderncmake-populate'
[ 77%] Completed 'moderncmake-populate'
[100%] Built target moderncmake-populate
hii
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
actual build output:
-- Populating moderncmake
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build/moderncmake-subbuild
gmake[1]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[2]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Entering directory '/tmp/test/build/moderncmake-subbuild'
[ 11%] Performing update step for 'moderncmake-populate'
HEAD is now at dea7d40
[ 22%] No patch step for 'moderncmake-populate'
[ 33%] No configure step for 'moderncmake-populate'
[ 44%] No build step for 'moderncmake-populate'
[ 55%] No install step for 'moderncmake-populate'
[ 66%] No test step for 'moderncmake-populate'
[ 77%] Completed 'moderncmake-populate'
gmake[3]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
[100%] Built target moderncmake-populate
gmake[2]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
gmake[1]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
hii
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
The output shows Entering directory
when the build project is out-of-source. The same does not happen on configure stage.
Steps to replicate
Test project:
cmake_minimum_required(VERSION 3.20)
project(MyProj VERSION 0.1)
include(FetchContent)
set(url https://gist.github.com/c61dbb39bca0e4fb7d1f73b0d66a4fd1)
FetchContent_Populate(moderncmake
# QUIET
GIT_REPOSITORY ${url}
)
message("hi")
- Configure and build with Unix Makefile generator. Configure and build output:
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Populating moderncmake
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build/moderncmake-subbuild
[ 11%] Creating directories for 'moderncmake-populate'
[ 22%] Performing download step (git clone) for 'moderncmake-populate'
Cloning into 'moderncmake-src'...
Already on 'master'
Your branch is up to date with 'origin/master'.
[ 33%] Performing update step for 'moderncmake-populate'
HEAD is now at dea7d40
[ 44%] No patch step for 'moderncmake-populate'
[ 55%] No configure step for 'moderncmake-populate'
[ 66%] No build step for 'moderncmake-populate'
[ 77%] No install step for 'moderncmake-populate'
[ 88%] No test step for 'moderncmake-populate'
[100%] Completed 'moderncmake-populate'
[100%] Built target moderncmake-populate
hi
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
- The project is now up-to-date. Modify
CMakeLists.txt
file and build again (i changed line 13 frommessage("hi")
intomessage("hii")
. Build output:
-- Populating moderncmake
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build/moderncmake-subbuild
gmake[1]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[2]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Entering directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
gmake[3]: Entering directory '/tmp/test/build/moderncmake-subbuild'
[ 11%] Performing update step for 'moderncmake-populate'
HEAD is now at dea7d40
[ 22%] No patch step for 'moderncmake-populate'
[ 33%] No configure step for 'moderncmake-populate'
[ 44%] No build step for 'moderncmake-populate'
[ 55%] No install step for 'moderncmake-populate'
[ 66%] No test step for 'moderncmake-populate'
[ 77%] Completed 'moderncmake-populate'
gmake[3]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
[100%] Built target moderncmake-populate
gmake[2]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
gmake[1]: Leaving directory '/tmp/test/build/moderncmake-subbuild'
hii
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build