Skip to content

A CMake module to apply local patches to projects built with ExternalProject_Add().

License

Notifications You must be signed in to change notification settings

Tulon/generate-patch-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About

In this repo you'll find a single CMake module whose purpose is to apply patches to projects built with ExternalProject_Add().

Usage

generate_patch_commands(
	<output var> [USE_GIT_AM] PATCHES /path/to/patches/*.patch [more patches])

The <output var> will then contain a sequence of COMMAND ... elements that apply the specified patches. Note that having the globbing expression that matches no files is permitted.

Typical Usage Scenario

generate_patch_commands(
	patch_commands USE_GIT_AM PATCHES
	"${CMAKE_CURRENT_SOURCE_DIR}/patches/*.patch"
)

ExternalProject_Add(
	...
	PATCH_COMMAND git reset --hard ${git_tag}
	${patch_commands}
	...
)

As USE_GIT_AM is used here, the patches will be applied by git am, and are expected to be generated by git format-patch

If USE_GIT_AM is not specified, patches will be applied by the patch command. In such a case, this function is best used from a custom step created by ExternalProject_Add_Step() that copies the source code from the source directory to the build directory and then applies the patches to the build directory.

License

Apache License 2.0

About

A CMake module to apply local patches to projects built with ExternalProject_Add().

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages