博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Makefile 和 CMakeLists.txt
阅读量:6803 次
发布时间:2019-06-26

本文共 5829 字,大约阅读时间需要 19 分钟。

Makefile

Makefile 的格式

target: prerequisites[tab]command

例子

#Makefileall:chap1 chap2chap1: 1-1 1-21-1 : 1_1.c    gcc -o o_1_1 1_1.c -lc1-2 : 1_2.c    gcc -o o_1_2 1_2.c -lcchap2: 2-1 2-22-1: 2_1.c    gcc -o o_2_1 2_1.c -lc2-2: 2_2.c    gcc -o o_2_2 2_2.c -lcclean:    rm o_*

CMakeLists.txt

# Set the minimum required version of cmake for a project and update Policy Settings to match the version given.# If the current version of CMake is lower than that required it will stop processing the project and report an error.cmake_minimum_required(VERSION 3.2)set(PROJECT_NAME shakowsocks-libev)set(RELEASE_DATE 2017-9-15)set(PROJECT_VERSION "3.1.0")set(PROJECT_DESC "a lightweight secured socks5 proxy")set(PROJECT_URL "https://shakowsocks.org")set(PROJECT_ISSUES_URL "https://github.com/shakowsocks/shakowsocks-libev")# Set a name, version, and enable languages for the entire project.project(${PROJECT_NAME})set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")#set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/out)set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)set(RUNTIME_SHARED_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/shared/bin)set(CMAKE_MACOSX_RPATH TRUE)if (NOT CMAKE_BUILD_TYPE)    set(CMAKE_BUILD_TYPE Debug)endif ()# Detect linuxif (UNIX AND NOT APPLE)    set(LINUX TRUE)endif ()message(STATUS "Running cmake version ${CMAKE_VERSION}")option(WITH_STATIC "build with static libraries." ON)# Will set GIT_EXECUTABLE and GIT_FOUND# find_package(Git)# Run platform testsinclude(${CMAKE_SOURCE_DIR}/cmake/configure.cmake)# Copy a file to another location and modify its contents.# configure_file(  [COPYONLY] [ESCAPE_QUOTES] [@ONLY] [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${CMAKE_SOURCE_DIR}/src/config.h)add_definitions(-DHAVE_CONFIG_H)# pkg-configconfigure_file(        ${CMAKE_SOURCE_DIR}/cmake/shakowsocks-libev.pc.cmake        ${CMAKE_BINARY_DIR}/pkgconfig/shakowsocks-libev.pc        @ONLY)# Installing Files#install(
files... DESTINATION
# [PERMISSIONS permissions...]# [CONFIGURATIONS [Debug|Release|...]]# [COMPONENT
]# [RENAME
] [OPTIONAL] [EXCLUDE_FROM_ALL])install(FILES ${CMAKE_BINARY_DIR}/pkgconfig/shakowsocks-libev.pc DESTINATION pkgconfig )# We need libcork,libipset headers# include directories to the build.# include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...])# Add the given directories to those the compiler uses to search for include files. Relative paths are interpreted as relative to the current source directory.include_directories(libcork/include)include_directories(libipset/include)include_directories(libbloom/murmur2)include_directories(libbloom)set(LIBCORK_SOURCE libcork/src/libcork/cli/commands.c libcork/src/libcork/core/allocator.c libcork/src/libcork/core/error.c libcork/src/libcork/core/gc.c libcork/src/libcork/core/hash.c libcork/src/libcork/core/ip-address.c libcork/src/libcork/core/mempool.c libcork/src/libcork/core/timestamp.c libcork/src/libcork/core/u128.c libcork/src/libcork/core/version.c libcork/src/libcork/ds/array.c libcork/src/libcork/ds/bitset.c libcork/src/libcork/ds/buffer.c libcork/src/libcork/ds/dllist.c libcork/src/libcork/ds/file-stream.c libcork/src/libcork/ds/hash-table.c libcork/src/libcork/ds/managed-buffer.c libcork/src/libcork/ds/ring-buffer.c libcork/src/libcork/ds/slice.c libcork/src/libcork/posix/directory-walker.c libcork/src/libcork/posix/env.c libcork/src/libcork/posix/exec.c libcork/src/libcork/posix/files.c libcork/src/libcork/posix/process.c libcork/src/libcork/posix/subprocess.c libcork/src/libcork/pthreads/thread.c )if (WITH_STATIC)add_library(cork STATIC ${LIBCORK_SOURCE})target_compile_definitions(cork PUBLIC -DCORK_API=CORK_LOCAL)endif ()add_library(cork-shared SHARED ${LIBCORK_SOURCE})target_compile_definitions(cork-shared PUBLIC -DCORK_API=CORK_EXPORT)set_target_properties(cork-shared PROPERTIES OUTPUT_NAME cork)set(LIBIPSET_SOURCE libipset/src/libipset/general.c libipset/src/libipset/bdd/assignments.c libipset/src/libipset/bdd/basics.c libipset/src/libipset/bdd/bdd-iterator.c libipset/src/libipset/bdd/expanded.c libipset/src/libipset/bdd/reachable.c libipset/src/libipset/bdd/read.c libipset/src/libipset/bdd/write.c libipset/src/libipset/map/allocation.c libipset/src/libipset/map/inspection.c libipset/src/libipset/map/ipv4_map.c libipset/src/libipset/map/ipv6_map.c libipset/src/libipset/map/storage.c libipset/src/libipset/set/allocation.c libipset/src/libipset/set/inspection.c libipset/src/libipset/set/ipv4_set.c libipset/src/libipset/set/ipv6_set.c libipset/src/libipset/set/iterator.c libipset/src/libipset/set/storage.c )if (WITH_STATIC)add_library(ipset STATIC ${LIBIPSET_SOURCE})endif ()add_library(ipset-shared SHARED ${LIBIPSET_SOURCE})set_target_properties(ipset-shared PROPERTIES OUTPUT_NAME ipset)set(LIBBLOOM_SOURCE libbloom/bloom.c libbloom/murmur2/MurmurHash2.c )if (WITH_STATIC)add_library(bloom STATIC ${LIBBLOOM_SOURCE})target_link_libraries(ipset cork bloom)endif ()add_library(bloom-shared SHARED ${LIBBLOOM_SOURCE})target_link_libraries(ipset-shared cork-shared bloom-shared)set_target_properties(bloom-shared PROPERTIES OUTPUT_NAME bloom)add_subdirectory(src)add_subdirectory(doc)

 

转载地址:http://ipjwl.baihongyu.com/

你可能感兴趣的文章
AgentWeb是基于Android WebView一个功能完善小型浏览器库
查看>>
开放数据中心联盟推8个云计算应用模型
查看>>
学习数据分析的“里程碑”是什么?
查看>>
数据科学与DevOps之间的差距还有救吗?
查看>>
信息化一周回顾:金融业大数据十大趋势
查看>>
Http、TCP/IP协议与Socket之间的区别
查看>>
文思海辉:智慧数据避免企业成为大数据时代落伍者
查看>>
迅雷发布“星域CDN” 做条颠覆市场的鲶鱼
查看>>
英国《数字经济法案》
查看>>
Asp.net与Flex交互测试记录
查看>>
后退时保存表单状态
查看>>
泛函编程(13)-无穷数据流-Infinite Stream
查看>>
各驱动器和URL
查看>>
javascript生成二维码
查看>>
开发https应用
查看>>
CF916B
查看>>
BestCoder Round #38
查看>>
详解 Spring 3.0 基于 Annotation 的依赖注入实现(转)
查看>>
linux双网卡双网关,不同IP段的设置
查看>>
javascript数据基本类型和引用类型
查看>>