CMakeLists.txt 919 字节
Newer Older
羽飞's avatar
羽飞 已提交
1 2
ADD_EXECUTABLE(obclient)
MESSAGE("Begin to build " obclient)
羽飞's avatar
羽飞 已提交
3

4 5
INCLUDE(readline)
MINIOB_FIND_READLINE()
羽飞's avatar
羽飞 已提交
6

7
IF (HAVE_READLINE)
羽飞's avatar
羽飞 已提交
8
    TARGET_LINK_LIBRARIES(obclient ${READLINE_LIBRARY})
9
    TARGET_INCLUDE_DIRECTORIES(obclient PRIVATE ${READLINE_INCLUDE_DIR})
羽飞's avatar
羽飞 已提交
10
    ADD_DEFINITIONS(-DUSE_READLINE)
11
    MESSAGE ("obclient use readline")
羽飞's avatar
羽飞 已提交
12 13 14
ELSE ()
    MESSAGE ("readline is not found")
ENDIF()
羽飞's avatar
羽飞 已提交
15 16 17 18 19 20 21 22 23

FILE(GLOB_RECURSE ALL_SRC *.cpp)
FOREACH (F ${ALL_SRC})

    SET(PRJ_SRC ${PRJ_SRC} ${F})
    MESSAGE("Use " ${F})

ENDFOREACH (F)

羽飞's avatar
羽飞 已提交
24 25
TARGET_SOURCES(obclient PRIVATE ${PRJ_SRC})
TARGET_LINK_LIBRARIES(obclient common pthread dl)
羽飞's avatar
羽飞 已提交
26 27 28 29

# Target 必须在定义 ADD_EXECUTABLE 之后, programs 不受这个限制
# TARGETS和PROGRAMS 的默认权限是OWNER_EXECUTE, GROUP_EXECUTE, 和WORLD_EXECUTE,即755权限, programs 都是处理脚步类
# 类型分为RUNTIME/LIBRARY/ARCHIVE, prog
羽飞's avatar
羽飞 已提交
30
INSTALL(TARGETS obclient RUNTIME DESTINATION bin)