CMakeLists.txt format and generation [SOLVED]

Gary Aitken freebsd at
Fri Dec 7 06:18:13 UTC 2018

On 12/6/18 2:30 PM, Gary Aitken wrote:
> Trying to build a dev version of a port, and need to tweak patch-CMakeLists.txt
> to match the dev version's CMakeList.txt which is different.
> It's not clear to me how these are generated.
> In particular, if I look at the old one for this port, cad/freecad/files/patch-CMakeLists.txt, I see this:
> --- CMakeLists.txt.orig 2017-07-28 17:35:48 UTC
> +++ CMakeLists.txt
> @@ -661,33 +661,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darw
>               if (WIN32)
>                   find_package(HDF5 COMPONENTS NO_MODULE REQUIRED static)
>               else()
> -                find_package(PkgConfig)
> If I look at .../work/xxx/CMakeLists.txt.orig nothing seems to line up.
> Starting at line 661, I see:
>          if(UNIX OR WIN32)
>              find_package(VTK COMPONENTS vtkCommonCore REQUIRED NO_MODULE)
> ...
> It is not until line 699 that the above diff lines appear.
> The
>    @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darw
> referred to on the @@ line is at line 561.
> What is its significance, and must this reference be unique?
> It looks like it is the closest preceeding conditional beginning at the
> first char in a line.  If the new code has an intervening if() and endif(),
> referencing the endif won't be unique, but the corresponding if() would be.
> I've tried various tweaks and guesses but can't get make patch to accept
> what I've supplied for patch-CMakeLists.txt
> Any helpful hints would be much appreciated.
> Thanks,

I finally found this link for understanding the format of the patches:
The problem was a missing space at the start of the context lines which
were unchanged.

More information about the freebsd-questions mailing list