Align osx&linux build

This commit is contained in:
Nils O. Selåsdal
2025-07-17 14:04:14 +02:00
parent 2bd91ae751
commit abf430dabb
2 changed files with 10 additions and 3 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 4.0.0) cmake_minimum_required(VERSION 3.12)
project(libucore C) project(libucore C)
execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} describe --abbrev=5 --dirty --always OUTPUT_VARIABLE version_revision WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} describe --abbrev=5 --dirty --always OUTPUT_VARIABLE version_revision WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -28,6 +28,12 @@ if (BUILD_SANITIZE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
endif() endif()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the property for multi-config generators as well, if applicable
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
endif()
include_directories(include) include_directories(include)
add_subdirectory(src) add_subdirectory(src)
+3 -2
View File
@@ -1,14 +1,15 @@
file(GLOB TEST_SOURCE_FILES test_*.c) file(GLOB TEST_SOURCE_FILES test_*.c)
link_libraries(check ucore Threads::Threads)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories("/opt/homebrew/include") include_directories("/opt/homebrew/include")
link_directories("/opt/homebrew/lib") link_directories("/opt/homebrew/lib")
list(REMOVE_ITEM TEST_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_ringbuf.c) list(REMOVE_ITEM TEST_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_ringbuf.c)
else() else()
target_link_libraries(rt) link_libraries(rt)
endif() endif()
add_executable(test_runner ${TEST_SOURCE_FILES}) add_executable(test_runner ${TEST_SOURCE_FILES})
target_link_libraries(test_runner check ucore PRIVATE Threads::Threads)
add_custom_target(test COMMAND test_runner add_custom_target(test COMMAND test_runner
DEPENDS test_runner DEPENDS test_runner