cmake: Debug build sets DEBUG, properly find check lib
This commit is contained in:
+4
-3
@@ -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)
|
||||
|
||||
@@ -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
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user