From f1d0c012b753d4cc24e6213aa5459e69601b28f9 Mon Sep 17 00:00:00 2001 From: Christian Burger Date: Thu, 14 Apr 2022 09:31:19 +0200 Subject: [PATCH] fixing debug facility in when NDEBUG is set - changed libvterm.cmake so it is easier to integrate in other projects --- CMakeLists.txt | 4 ++++ Debug.hpp | 6 +++--- cmake/libvterm.cmake | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abe761f..225cad0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,10 @@ add_library(NCursesPtyWindow Window.cpp SingleUserInput.cpp Debug.cpp) ### libraries include("cmake/libvterm.cmake") +if(EXISTS libvtermProject) + add_dependencies(NCursesPtyWindow libvtermProject) +endif() + find_library(UTIL_LIBRARY util) target_link_libraries(NCursesPtyWindow ${CURSES_LIBRARIES} ${LIBVTERM_LIBRARY} ${UTIL_LIBRARY}) diff --git a/Debug.hpp b/Debug.hpp index 8d68390..eeff7bb 100644 --- a/Debug.hpp +++ b/Debug.hpp @@ -118,9 +118,9 @@ namespace krikkel #define __debug_stringify_switch_case_end_bool(value) #define __debug_stringify_switch_case_end_string(value) #define __debug_stringify_switch_case_end_number(value) -#define __debug_stringify_switch_end() -#define __debug_make_bytes_printable_table(bytes) -#define __debug_make_bytes_printable(bytes) +#define __debug_stringify_switch_end(__prop) +#define __debug_make_bytes_printable_table(__bytes) +#define __debug_make_bytes_printable(__bytes) #endif /* NDEBUG */ diff --git a/cmake/libvterm.cmake b/cmake/libvterm.cmake index 95e6eb3..636b572 100644 --- a/cmake/libvterm.cmake +++ b/cmake/libvterm.cmake @@ -1,7 +1,12 @@ # @author Christian Burger # @brief searches for libvterm and builds it if not found # -# requires NCursesPtyWindow target; provides LIBVTERM_LIBRARY +# provides LIBVTERM_LIBRARY and include path +# dependency must be added like this: +# if(EXISTS libvtermProject) +# add_dependencies( libvtermProject) +# endif() + find_library(LIBVTERM_LIBRARY NAMES libvterm.so.0.0.2 vterm) @@ -17,5 +22,4 @@ if(LIBVTERM_LIBRARY STREQUAL "LIBVTERM_LIBRARY-NOTFOUND") ExternalProject_Get_property(libvtermProject SOURCE_DIR) set(LIBVTERM_LIBRARY "${SOURCE_DIR}/.libs/libvterm.a") include_directories(SYSTEM "${SOURCE_DIR}/include") - add_dependencies(NCursesPtyWindow libvtermProject) endif()