diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b6e585..cd1eb76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,14 +4,16 @@ cmake_minimum_required(VERSION 2.8.4) # 项目信息 project(MiniFTPD) -set(CMAKE_CXX_STANDARD 14) +# specify the C++ standard +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) -# C++ 11 -add_definitions(-std=c++11) +# 查找指定目录下的所有源文件, +# 并将名称保存到 DIR_SRCS 变量 +aux_source_directory(src/ DIR_SRCS) # 指定生成目标 -add_executable(MiniFTPD main.cpp tcp.cpp utility.cpp - epoll_event.cpp signal_wrapper.cpp pipe_wrapper.cpp ftp_handler.cpp command_handle.cpp - data_handle.cpp buffer.cpp ipc_utility.cpp record_lock.cpp) +add_executable(MiniFTPD ${DIR_SRCS}) +# 添加链接库 target_link_libraries(MiniFTPD crypt) \ No newline at end of file diff --git a/buffer.cpp b/src/buffer.cpp similarity index 100% rename from buffer.cpp rename to src/buffer.cpp diff --git a/buffer.h b/src/buffer.h similarity index 100% rename from buffer.h rename to src/buffer.h diff --git a/command_handle.cpp b/src/command_handle.cpp similarity index 100% rename from command_handle.cpp rename to src/command_handle.cpp diff --git a/command_handle.h b/src/command_handle.h similarity index 100% rename from command_handle.h rename to src/command_handle.h diff --git a/common.h b/src/common.h similarity index 100% rename from common.h rename to src/common.h diff --git a/data_handle.cpp b/src/data_handle.cpp similarity index 100% rename from data_handle.cpp rename to src/data_handle.cpp diff --git a/data_handle.h b/src/data_handle.h similarity index 100% rename from data_handle.h rename to src/data_handle.h diff --git a/epoll_event.cpp b/src/epoll_event.cpp similarity index 100% rename from epoll_event.cpp rename to src/epoll_event.cpp diff --git a/epoll_event.h b/src/epoll_event.h similarity index 100% rename from epoll_event.h rename to src/epoll_event.h diff --git a/ftp_codes.h b/src/ftp_codes.h similarity index 100% rename from ftp_codes.h rename to src/ftp_codes.h diff --git a/ftp_handler.cpp b/src/ftp_handler.cpp similarity index 100% rename from ftp_handler.cpp rename to src/ftp_handler.cpp diff --git a/ftp_handler.h b/src/ftp_handler.h similarity index 100% rename from ftp_handler.h rename to src/ftp_handler.h diff --git a/ipc_utility.cpp b/src/ipc_utility.cpp similarity index 100% rename from ipc_utility.cpp rename to src/ipc_utility.cpp diff --git a/ipc_utility.h b/src/ipc_utility.h similarity index 100% rename from ipc_utility.h rename to src/ipc_utility.h diff --git a/main.cpp b/src/main.cpp similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/pipe_wrapper.cpp b/src/pipe_wrapper.cpp similarity index 100% rename from pipe_wrapper.cpp rename to src/pipe_wrapper.cpp diff --git a/pipe_wrapper.h b/src/pipe_wrapper.h similarity index 100% rename from pipe_wrapper.h rename to src/pipe_wrapper.h diff --git a/record_lock.cpp b/src/record_lock.cpp similarity index 100% rename from record_lock.cpp rename to src/record_lock.cpp diff --git a/record_lock.h b/src/record_lock.h similarity index 100% rename from record_lock.h rename to src/record_lock.h diff --git a/signal_wrapper.cpp b/src/signal_wrapper.cpp similarity index 100% rename from signal_wrapper.cpp rename to src/signal_wrapper.cpp diff --git a/signal_wrapper.h b/src/signal_wrapper.h similarity index 100% rename from signal_wrapper.h rename to src/signal_wrapper.h diff --git a/tcp.cpp b/src/tcp.cpp similarity index 100% rename from tcp.cpp rename to src/tcp.cpp diff --git a/tcp.h b/src/tcp.h similarity index 100% rename from tcp.h rename to src/tcp.h diff --git a/utility.cpp b/src/utility.cpp similarity index 100% rename from utility.cpp rename to src/utility.cpp diff --git a/utility.h b/src/utility.h similarity index 100% rename from utility.h rename to src/utility.h