diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..4757b99 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,23 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "debug", + "displayName": "Debug", + "description": "Debug build", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "ZBBS_DEBUG": "ON" + } + }, + { + "name": "release", + "displayName": "Release", + "description": "Release build", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "ZBBS_DEBUG": "OFF" + } + } + ] +} \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 737f45f..2911432 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,7 @@ add_executable(zbbs-client-tui) +set_property(TARGET zbbs-client-tui PROPERTY C_STANDARD 23) + file(GLOB M_HEADERS "*.h") file(GLOB M_SOURCES "*.c") @@ -26,4 +28,22 @@ target_link_libraries(zbbs-client-tui widget modals ${CURSES_LIBRARIES} -) \ No newline at end of file +) + +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) + +elseif( + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR + (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +) + + target_compile_options(zbbs-client-tui PRIVATE -Wall -ggdb -pedantic) + +endif() +endif() \ No newline at end of file