Skip to content

[BUG] Patch commands fail trying to re-apply the same patch twice #618

Open
@Jazzinghen

Description

@Jazzinghen

Due to a dependency with improper CMakeLists.txt I tried to use the PATCHES field, however the second time I run the configuration CMake fails during FetchContent_MakeAvailable for that package with this output:

[cmake] -- CPM: Adding package sqlite_protobuf@0 (082596c282cab90f50b6d6dee5f9be22fd503dbe)
[cmake] [ 11%] Performing update step for 'sqlite_protobuf-populate'
[cmake] -- Already at requested ref: 082596c282cab90f50b6d6dee5f9be22fd503dbe
[cmake] [ 22%] Performing patch step for 'sqlite_protobuf-populate'
[cmake] patching file CMakeLists.txt
[cmake] Reversed (or previously applied) patch detected!  Assume -R? [n] 
[cmake] Apply anyway? [n] 
[cmake] Skipping patch.
[cmake] 1 out of 1 hunk ignored -- saving rejects to file CMakeLists.txt.rej
[cmake] patching file src/CMakeLists.txt
[cmake] Reversed (or previously applied) patch detected!  Assume -R? [n] 
[cmake] Apply anyway? [n] 
[cmake] Skipping patch.
[cmake] 2 out of 2 hunks ignored -- saving rejects to file src/CMakeLists.txt.rej
[cmake] make[2]: *** [CMakeFiles/sqlite_protobuf-populate.dir/build.make:118: sqlite_protobuf-populate-prefix/src/sqlite_protobuf-populate-stamp/sqlite_protobuf-populate-patch] Error 1
[cmake] make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/sqlite_protobuf-populate.dir/all] Error 2
[cmake] make: *** [Makefile:91: all] Error 2
[cmake] 
[cmake] CMake Error at /usr/share/cmake/Modules/FetchContent.cmake:1918 (message):
[cmake]   Build step for sqlite_protobuf failed: 2
[cmake] Call Stack (most recent call first):
[cmake]   /usr/share/cmake/Modules/FetchContent.cmake:1609 (__FetchContent_populateSubbuild)
[cmake]   /usr/share/cmake/Modules/FetchContent.cmake:2145:EVAL:2 (__FetchContent_doPopulation)
[cmake]   /usr/share/cmake/Modules/FetchContent.cmake:2145 (cmake_language)
[cmake]   /usr/share/cmake/Modules/FetchContent.cmake:2384 (__FetchContent_Populate)
[cmake]   build/cmake/CPM_0.40.2.cmake:1114 (FetchContent_MakeAvailable)
[cmake]   build/cmake/CPM_0.40.2.cmake:895 (cpm_fetch_package)
[cmake]   src/wrapper/CMakeLists.txt:3 (cpmaddpackage)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!

This is the relevant piece of my CMakeLists.txt:

cpmaddpackage(
  NAME
  sqlite_protobuf
  GITHUB_REPOSITORY
  rgov/sqlite_protobuf
  GIT_TAG
  082596c282cab90f50b6d6dee5f9be22fd503dbe
  PATCHES
  "${PROJECT_SOURCE_DIR}/cmake/sqlite_protobuf_fix.patch")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions