ulib/CMakeLists.txt

32 lines
932 B
CMake
Raw Normal View History

2023-11-16 14:28:55 +08:00
cmake_minimum_required(VERSION 3.10)
2023-12-05 10:08:21 +08:00
project(ulib LANGUAGES CXX VERSION 0.1.0)
2023-12-05 10:06:05 +08:00
set(CMAKE_CXX_STANDARD 98)
2023-11-16 14:28:55 +08:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2023-12-05 10:06:05 +08:00
set(CMAKE_CXX_EXTENSIONS OFF)
2023-11-16 14:28:55 +08:00
2023-12-05 11:33:13 +08:00
find_package(Threads REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2023-11-16 14:28:55 +08:00
2023-12-05 11:33:13 +08:00
set(FMT_USE_CPP11 OFF)
set(FMT_TEST OFF)
2023-12-05 13:47:33 +08:00
set(FMT_USE_CPP11 OFF)
2023-12-05 11:33:13 +08:00
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt)
2023-11-16 14:28:55 +08:00
2023-12-05 11:33:13 +08:00
option(ULIB_BUILD_TESTS "Build tests" OFF)
2023-11-16 14:28:55 +08:00
2023-12-05 11:33:13 +08:00
add_library(${PROJECT_NAME} STATIC
src/ulib/empty.cpp
src/ulib/log/logger.cpp
src/ulib/log/log.cpp
src/ulib/log/level.cpp
)
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt)
target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL)
target_include_directories(${PROJECT_NAME} PUBLIC src)
2023-11-16 14:28:55 +08:00
2023-12-05 11:34:00 +08:00
add_executable(ulib_main_test src/main.cpp)
target_link_libraries(ulib_main_test PRIVATE ${PROJECT_NAME})
2023-12-05 11:49:59 +08:00
install(TARGETS ${PROJECT_NAME} DESTINATION lib)