vikasnkumar / hotpatch

Hot patching executables on Linux using .so file injection
http://www.selectiveintellect.com/hotpatch.html
BSD 3-Clause "New" or "Revised" License
360 stars 119 forks source link

How can I use this project with ExternalProject_Add #14

Closed DevasiaThomas closed 6 years ago

DevasiaThomas commented 6 years ago

Hi Vikas, This is not an issue, but I am having trouble using this project with ExternalProject_Add(). I'm expecting it to build/install and have the include directories available even before my project is considered. But when I include hotpatch.h it cannot find it. I'm new to cmake so please forgive me for being a noob. This is what I have so far.

cmake_minimum_required(VERSION 3.10)
project(agentloader)
set(CMAKE_C_STANDARD 99)
include(ExternalProject)
ExternalProject_Add(project_hotpatch
        GIT_REPOSITORY https://github.com/vikasnkumar/hotpatch.git
        PREFIX ${CMAKE_CURRENT_BINARY_DIR}/hotpatch)
ExternalProject_Get_Property(project_hotpatch install_dir)
add_library(hotpatch STATIC IMPORTED)
set_property(TARGET hotpatch PROPERTY IMPORTED_LOCATION ${install_dir}/lib/hotpatch_s)
add_dependencies(hotpatch project_hotpatch)
include_directories(${install_dir}/include)
add_executable(agentloader main.c agentloader.h)
target_link_libraries(agentloader hotpatch)
DevasiaThomas commented 6 years ago

I manage to solve my problems using the FetchContent module