patchelfcrc/CMakeLists.txt

42 lines
1.2 KiB
CMake
Raw Permalink Normal View History

2022-08-16 21:42:23 +02:00
cmake_minimum_required(VERSION 3.5)
project(patchelfcrc LANGUAGES C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(ELF REQUIRED libelf)
set (CFILES
main.c
2022-08-16 22:27:37 +02:00
version.c
named_crcs.c
2022-09-05 20:46:43 +02:00
crc.c
2022-10-16 20:51:29 +02:00
elfpatch.c
reporting.c
2022-08-16 21:42:23 +02:00
)
2022-08-16 22:27:37 +02:00
set(GEN_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/include/generated")
add_custom_target(
version-header
COMMAND
mkdir -p ${GEN_HEADER_PATH} && bash "${CMAKE_CURRENT_SOURCE_DIR}/gen_version_header.sh" "${GEN_HEADER_PATH}/version.h"
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
add_compile_options(-Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)
2022-08-19 22:16:11 +02:00
set(FORT_ENABLE_TESTING OFF CACHE INTERNAL "")
add_subdirectory(3rdparty/libfort)
2022-08-20 11:26:04 +02:00
add_subdirectory(linklist-lib)
2022-08-19 22:16:11 +02:00
2022-08-16 21:42:23 +02:00
add_executable(${PROJECT_NAME} ${CFILES})
2022-08-20 11:26:04 +02:00
target_link_libraries(${PROJECT_NAME} ${ELF_LIBRARIES} fort linklist-lib)
2022-08-16 21:42:23 +02:00
target_link_directories(${PROJECT_NAME} PRIVATE ${ELF_LIBRARY_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE ${ELF_INCLUDE_DIRS})
2022-08-16 22:27:37 +02:00
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/include")
target_include_directories(${PROJECT_NAME} PRIVATE "include")
add_dependencies(${PROJECT_NAME} version-header)
2022-08-16 21:42:23 +02:00