2025-10-11 01:11:30 +01:00
|
|
|
# Tool executable project
|
|
|
|
|
project(aaruformattool C CXX)
|
2022-10-02 17:39:25 +01:00
|
|
|
|
2025-10-11 01:11:30 +01:00
|
|
|
# Find required dependencies
|
2022-10-03 21:30:50 +01:00
|
|
|
find_package(ICU COMPONENTS uc REQUIRED)
|
2025-08-01 16:07:33 +01:00
|
|
|
find_package(Argtable3 CONFIG REQUIRED)
|
2022-10-03 21:30:50 +01:00
|
|
|
|
2025-10-11 01:11:30 +01:00
|
|
|
# Tool executable
|
|
|
|
|
add_executable(aaruformattool
|
|
|
|
|
main.c
|
|
|
|
|
version.h
|
|
|
|
|
aaruformattool.h
|
|
|
|
|
identify.c
|
|
|
|
|
info.c
|
|
|
|
|
helpers.c
|
|
|
|
|
read.c
|
|
|
|
|
printhex.c
|
|
|
|
|
verify.c
|
|
|
|
|
ecc_cd.c
|
|
|
|
|
commands.h
|
|
|
|
|
commands.c
|
|
|
|
|
usage.h
|
|
|
|
|
usage.c
|
|
|
|
|
compare.c
|
|
|
|
|
cli_compare.c
|
|
|
|
|
convert.c
|
|
|
|
|
termbox2.h
|
|
|
|
|
)
|
2022-10-03 21:30:50 +01:00
|
|
|
|
2025-10-11 01:11:30 +01:00
|
|
|
# Set C as the linker language (even though we enable CXX for stdlib)
|
|
|
|
|
set_target_properties(aaruformattool PROPERTIES LINKER_LANGUAGE C)
|
|
|
|
|
|
|
|
|
|
# Set up include directories
|
|
|
|
|
target_include_directories(aaruformattool PRIVATE ${ICU_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
|
|
# Link libraries
|
|
|
|
|
target_link_libraries(aaruformattool
|
|
|
|
|
PRIVATE
|
|
|
|
|
aaruformat
|
|
|
|
|
argtable3::argtable3
|
|
|
|
|
ICU::uc
|
|
|
|
|
)
|
|
|
|
|
|
2025-10-13 11:22:24 +01:00
|
|
|
# On Linux, enable GNU/POSIX feature test macros so functions like strerror_r
|
|
|
|
|
# and cfmakeraw are declared by system headers. We limit this to UNIX and not
|
|
|
|
|
# Apple (macOS provides these declarations differently).
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
|
target_compile_definitions(aaruformattool PRIVATE
|
|
|
|
|
_GNU_SOURCE
|
|
|
|
|
_DEFAULT_SOURCE
|
|
|
|
|
_XOPEN_SOURCE=700)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
2025-10-11 01:11:30 +01:00
|
|
|
# On macOS/iOS, explicitly link the C++ standard library for ICU dependencies
|
|
|
|
|
if(APPLE)
|
|
|
|
|
target_link_libraries(aaruformattool PRIVATE "-lc++")
|
|
|
|
|
endif()
|