cmake_minimum_required(VERSION 3.1) # 源码以 UTF-8 编码保存,使用 MSVC 编译器需要加编译参数提供支持 if(MSVC) add_compile_options("$<$:/utf-8>") add_compile_options("$<$:/utf-8>") message(STATUS "optional: /UTF-8") endif(MSVC) function(api_exe target) add_executable(${target} ${target}.cpp) target_link_libraries(${target} mirai-cpp) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # 链接 pthread target_link_libraries(${target} pthread) # 静态链接 libgcc 和 libstdc++ target_link_libraries(${target} -static-libgcc -static-libstdc++) endif() endfunction() api_exe(RepeatMessage) api_exe(ImageMessage) api_exe(GetFriendList) api_exe(GetGroupList) api_exe(NewFriendEvent) api_exe(MemberJoinEvent) api_exe(BotEvents) api_exe(MemberLeaveEvent) api_exe(MessageType) api_exe(GroupMemberInfo) api_exe(GroupConfig) api_exe(Command) api_exe(VoiceMessage) api_exe(NudgeEvent) api_exe(FileMessage) api_exe(GetProfile) api_exe(GroupFile) api_exe(GroupAnnouncement)