FetchContent_MakeAvailable resets patches

A dependency I use via FetchContent is itself pulling further dependencies via FetchContent, similarly to the snippet below. It seems that CMake is cloning the repo, then applying both patches and finally perfoming an update step, which seems to check out the configured commit again, thereby removing the patches. How should I go about ensuring the patches are applied?


  GIT_REPOSITORY  https://github.com/flexible-collision-library/fcl.git
  GIT_TAG         43f9805445e73397077127556165f8af822c0383

  # Necessary to run git am in CI environment (git am requires committer name and email)
  GIT_CONFIG user.name=cmake user.email=cmake@localhost

      -C <SOURCE_DIR>

[ 22%] Performing download step (git clone) for 'fcl-populate'
cd /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps && /usr/bin/cmake -P /home/hristov/uni/fub_roscar/build/fub_reachability_based_planne
Cloning into 'fcl-src'...
Note: switching to '43f9805445e73397077127556165f8af822c0383'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 43f9805 Fix alias typename preventing Visual Studio 2015 compilation (#459)
cd /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps && /usr/bin/cmake -E touch /home/hristov/uni/fub_roscar/build/fub_reachability_based_
[ 33%] Performing patch step for 'fcl-populate'
cd /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/fcl-src && /usr/bin/git -C /home/hristov/uni/fub_roscar/build/fub_reachability_based_
planner/_deps/fcl-src am --ignore-date -- /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/crdc-src/third_party/patch/fcl-cmake-disable-warnings.patch /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/crdc-src/third_party/patch/fcl-cmake-skip-findpackage-ccd.patch
Applying: cmake: Disable warnings on GCC/Clang
Applying: cmake: Skip find_package call for ccd
cd /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/fcl-src && /usr/bin/cmake -E touch /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/fcl-subbuild/fcl-populate-prefix/src/fcl-populate-stamp/fcl-populate-patch
[ 44%] Performing update step for 'fcl-populate'
cd /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/fcl-src && /usr/bin/cmake -P /home/hristov/uni/fub_roscar/build/fub_reachability_based_planner/_deps/fcl-subbuild/fcl-populate-prefix/tmp/fcl-populate-gitupdate.cmake
Warning: you are leaving 2 commits behind, not connected to
any of your branches:

  982fa7b cmake: Skip find_package call for ccd
  cc9506c cmake: Disable warnings on GCC/Clang

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> 982fa7b

HEAD is now at 43f9805 Fix alias typename preventing Visual Studio 2015 compilation (#459)

I am using CMake version 3.16.3 and would prefer to not update to a newer version if not absolutely necessary.

It’s possible that the order of update and patch steps wasn’t properly defined in CMake 3.16.3, so I would probably need to update.

See #17229 - ExternalProject: No dependency between patch and update steps and comment on #21146.

1 Like