project(ftptest)message("----------cmake ${PROJECT_NAME}----------start")# 设置构建类型为Release # set(CMAKE_BUILD_TYPE Release)set(CMAKE_VERBOSE_MAKEFILE ON) #set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -rdynamic -O0 -ggdb -std=c++11 -Wall -Wno-deprecated -Werror -Wno-unused-function -Wno-builtin-macro-redefined -Wno-deprecated-declarations ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -Wreturn-type -fdata-sections -ffunction-sections -fstack-protector-strong -fPIC") ## -Wno-unused-variableinclude_directories(/usr/include) include_directories(/usr/local/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)link_directories(/usr/local/lib/) link_directories(/usr/lib) link_directories(/usr/lib32) link_directories(/usr/lib64) link_directories(/usr/local/lib64)#输出目录重定向 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)# 添加需要链接的库 set(OPENSSLLIBsslcrypto )set(POCOLIBPocoNetPocoNetSSLPocoCryptoPocoUtilPocoJSONPocoXMLPocoFoundation )set(LIBS${OPENSSLLIB}${POCOLIB}pthread )# 添加源文件 aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)# 添加可执行文件 add_executable(${PROJECT_NAME} ${SOURCES})target_link_libraries(${PROJECT_NAME} ${LIBS}) message("----------cmake ${PROJECT_NAME}----------end")