Fixed error with cmake not taking build flags

This commit is contained in:
2025-03-28 11:03:30 -04:00
parent e97bd6a727
commit 67b0b77156
2 changed files with 5 additions and 8 deletions

View File

@ -6,11 +6,7 @@ set(CMAKE_C_STANDARD 17)
add_executable($ENV{MAKE_NAME})
if(NOT "$ENV{MAKE_CFLAGS}" STREQUAL "")
string(REPLACE " " ";" CFLAGS_LIST $ENV{MAKE_CFLAGS})
foreach(X IN LISTS CFLAGS_LIST)
message(STATUS "Using C compilation flag ${X}")
add_compile_options(${X})
endforeach()
set_target_properties($ENV{MAKE_NAME} PROPERTIES COMPILE_FLAGS $ENV{MAKE_CFLAGS})
endif()
if(NOT "$ENV{MAKE_C_SRCS}" STREQUAL "")

View File

@ -25,6 +25,7 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state) {
break;
case ARG_TTL:
arguments->ttl = strtoul(arg, NULL, 10);
__attribute__ ((fallthrough));
case ARGP_KEY_ARG:
if (state->arg_num >= 2)
argp_usage(state);
@ -40,7 +41,7 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state) {
return 0;
}
static struct argp argp = {options, parse_opt, args_doc, doc};
static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
static bool stop = false;
@ -58,7 +59,7 @@ double avg = 0;
uint16_t calc_checksum(void * b, const size_t l) {
uint16_t sum = 0;
for (int i = 0; i < l; i++) {
for (size_t i = 0; i < l; i++) {
sum += *((uint16_t*)b + i);
}
@ -72,7 +73,7 @@ void send_ping() {
packet.hdr.un.echo.id = getpid();
packet.hdr.un.echo.sequence = xmit++;
for (int i = 0; i < sizeof(packet.msg) - 1; ++i) {
for (long unsigned i = 0; i < sizeof(packet.msg) - 1; ++i) {
packet.msg[i] = (char)i;
}
packet.msg[sizeof(packet.msg) - 1] = '\0';