42 lines
1.2 KiB
CMake
42 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(patchelfcrc LANGUAGES C)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(ELF REQUIRED libelf)
|
|
|
|
set (CFILES
|
|
main.c
|
|
version.c
|
|
named_crcs.c
|
|
crc.c
|
|
elfpatch.c
|
|
reporting.c
|
|
)
|
|
|
|
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)
|
|
|
|
set(FORT_ENABLE_TESTING OFF CACHE INTERNAL "")
|
|
add_subdirectory(3rdparty/libfort)
|
|
add_subdirectory(linklist-lib)
|
|
|
|
add_executable(${PROJECT_NAME} ${CFILES})
|
|
target_link_libraries(${PROJECT_NAME} ${ELF_LIBRARIES} fort linklist-lib)
|
|
target_link_directories(${PROJECT_NAME} PRIVATE ${ELF_LIBRARY_DIRS})
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${ELF_INCLUDE_DIRS})
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/include")
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "include")
|
|
add_dependencies(${PROJECT_NAME} version-header)
|
|
|
|
|