cmake_minimum_required(VERSION 4.0.2) project(FeatherLog) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED True) add_compile_definitions(FLOG_IMPL_CONSOLE_OUTPUTTER) # build with default console outputter add_compile_definitions(FLOG_IMPL_FILE_OUTPUTTER) # build with default file outputter add_compile_definitions(FLOG_IMPL_DEFAULT_FORMATTER) # build with default formatter # 定义源文件 set(${PROJECT_NAME}_SOURCES include/featherlog/log_manager.hpp include/featherlog/log_outputter.hpp include/featherlog/logger.hpp include/featherlog/log_formatter.hpp include/featherlog/log_level.hpp include/featherlog/log_message.hpp include/featherlog/flog_definitions.h include/featherlog/push_result.hpp include/featherlog/log_message_flag.hpp include/featherlog/featherlog.hpp src/log_manager.cpp src/log_message_flag.cpp include/featherlog/impl/flog_impl.hpp include/featherlog/impl/console_outputter.hpp) # 生成静态库 add_library(${PROJECT_NAME}_static STATIC ${${PROJECT_NAME}_SOURCES}) target_include_directories(${PROJECT_NAME}_static PUBLIC include) set_target_properties(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NAME} PREFIX lib) add_compile_definitions(FLOG_DLL_MODE) add_compile_definitions(FLOG_BUILDING_DLL) # 生成动态库 add_library(${PROJECT_NAME}_shared SHARED ${${PROJECT_NAME}_SOURCES}) target_include_directories(${PROJECT_NAME}_shared PUBLIC include) set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} PREFIX lib) include(CTest) enable_testing()