Let's say one's importing a cmake project from a github repository via the FetchContent route. In order for the repo, in this case hiberlite, to play nice with my project, I need to inject/patch/replace one of its headers, say hiberdefs.h located in ${hiberlite_SOURCE_DIR}/include with my own.
How does one do that such that my entire project only sees the modified header? Also, any libraries built by the repo must use the modified header.
CMakeLists.txt
cmake_minimum_required(VERSION 3.24)
project(hiberlite_patch)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)
FetchContent_Declare(hiberlite
GIT_REPOSITORY https://github.com/paulftw/hiberlite
GIT_TAG master
)
FetchContent_MakeAvailable(hiberlite)
include_directories(${hiberlite_SOURCE_DIR}/include)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} hiberlite)