set(libhello_src ${CMAKE_CURRENT_SOURCE_DIR}/libhello/src)
set(libhello_binary ${CMAKE_CURRENT_SOURCE_DIR}/libhello/build)
set(libhello_download ${CMAKE_CURRENT_SOURCE_DIR}/libhello/download)
set(libhello_install ${CMAKE_CURRENT_SOURCE_DIR}/libhello/install)
ExternalProject_Add(libhello
URL "/Users/wangshengxing/project/c/cmake/sharelib.zip"
DOWNLOAD_DIR ${libhello_download}
SOURCE_DIR "${libhello_src}"
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${libhello_src}
-DCMAKE_INSTALL_PREFIX=${libhello_install}
BINARY_DIR ${libhello_binary}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
)
URL:代码外部依赖的路径
DOWNLOAD_DIR:存放下载文件的路径
SOURCE_DIR:存入编译源文件的路径
CONFIGURE_COMMAND:执行cmake文件的指令,类似平常的"cmake …/"
BINARY_DIR:输出目前的目录,也就是平常使用的build目录
INSTALL_COMMAND:等效于手动输入"make install"