cmake: Debug build sets DEBUG, properly find check lib

This commit is contained in:
Nils O. Selåsdal
2026-04-06 23:25:56 +02:00
parent 85713d25c1
commit b2f834b7cd
3 changed files with 8 additions and 7 deletions
+4 -3
View File
@@ -10,7 +10,7 @@ set(libucore_VERSION ${libucore_VERSION_MAJOR}.${libucore_VERSION_MINOR}.${libuc
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wundef -Wcast-qual -Wshadow -Wcast-align -pipe -Wno-unused-parameter -Werror=implicit-function-declaration -Winit-self")
add_definitions(-D_FILE_OFFSET_BITS=64)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O2")
@@ -30,13 +30,14 @@ if (CODE_COVERAGE)
set(build_type "${build_type}-coverage")
endif()
add_compile_definitions($<$<CONFIG:Debug>:DEBUG>)
option(BUILD_SANITIZE "build with address sanitizer" OFF)
if (BUILD_SANITIZE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(build_type "${build_type}-sanitize")
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(CHECK REQUIRED IMPORTED_TARGET check)
include_directories(include)
add_subdirectory(src)
+3 -3
View File
@@ -25,9 +25,9 @@ extern "C" {
*/
typedef struct UCSArena UCSArena;
struct UCSArena {
char *start; // start of user buffer
char *curr; // next alloc point
char *end; // one past end of user buffer
unsigned char *start; // start of user buffer
unsigned char *curr; // next alloc point
unsigned char *end; // one past end of user buffer
};
/** Initialize a UCSArena with predefined backing array.
+1 -1
View File
@@ -1,6 +1,6 @@
file(GLOB TEST_SOURCE_FILES test_*.c)
link_libraries(check ucore Threads::Threads)
link_libraries(ucore Threads::Threads PkgConfig::CHECK)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories("/opt/homebrew/include")
link_directories("/opt/homebrew/lib")