CMake: updates compiler definitions

This commit is contained in:
2026-02-10 14:24:32 +02:00
parent 57e8894212
commit dbe46fbdfd
3 changed files with 22 additions and 34 deletions
+21 -21
View File
@@ -2,6 +2,26 @@ add_executable(zbbs-client-tui)
set_property(TARGET zbbs-client-tui PROPERTY C_STANDARD 23) set_property(TARGET zbbs-client-tui PROPERTY C_STANDARD 23)
if(
(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR
(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
)
if (ZBBS_DEBUG)
target_compile_options(zbbs-client-tui PRIVATE /W3)
message("Include debug info (Microsoft)")
endif()
elseif(
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
)
add_compile_definitions(_GNU_SOURCE)
# target_compile_definitions(zbbs-client-tui PRIVATE _GNU_SOURCE) -> doesn't work
if (ZBBS_DEBUG)
target_compile_options(zbbs-client-tui PRIVATE -Wall -ggdb -pedantic)
message("Include debug info (GNU/Clang)")
endif()
endif()
file(GLOB M_HEADERS "*.h") file(GLOB M_HEADERS "*.h")
file(GLOB M_SOURCES "*.c") file(GLOB M_SOURCES "*.c")
@@ -28,24 +48,4 @@ target_link_libraries(zbbs-client-tui
widget widget
modals modals
${CURSES_LIBRARIES} ${CURSES_LIBRARIES}
) )
if (ZBBS_DEBUG)
if(
(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR
(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
)
target_compile_options(zbbs-client-tui PRIVATE /W3)
message("Include debug info (Microsoft)")
elseif(
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
)
target_compile_options(zbbs-client-tui PRIVATE -Wall -ggdb -pedantic)
message("Include debug info (GNU/Clang)")
endif()
endif()
-13
View File
@@ -3,7 +3,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "types.h"
#define LOCAL_PORT 1999 #define LOCAL_PORT 1999
#define SERVER_PORT 2000 #define SERVER_PORT 2000
@@ -14,18 +13,6 @@
#define DIALOGUE_TEXT 4096 #define DIALOGUE_TEXT 4096
#define INPUT_TEXT DIALOGUE_TITLE #define INPUT_TEXT DIALOGUE_TITLE
#ifndef __USE_GNU
#define __USE_GNU 1
#endif
#ifndef __USE_MISC
#define __USE_MISC 1
#endif
#ifndef __USE_XOPEN_EXTENDED
#define __USE_XOPEN_EXTENDED 1
#endif
typedef struct params { typedef struct params {
unsigned short port; unsigned short port;
unsigned addr; unsigned addr;
+1
View File
@@ -22,6 +22,7 @@
#include "server.h" #include "server.h"
#include "app.h" #include "app.h"
#include "draw-modal.h" #include "draw-modal.h"
#include "types.h"
static void wait_side(query_args_t *q_args); static void wait_side(query_args_t *q_args);
void user_request_description(query_args_t *q_args); void user_request_description(query_args_t *q_args);