Skip to content

Instantly share code, notes, and snippets.

@Fraser999
Created October 5, 2015 03:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fraser999/53a72581675f4208e877 to your computer and use it in GitHub Desktop.
Save Fraser999/53a72581675f4208e877 to your computer and use it in GitHub Desktop.
Example showing ExternalProject_Add for DocOpt
include(ExternalProject)
# Set default ExternalProject root directory
set_directory_properties(PROPERTIES EP_PREFIX "${CMAKE_BINARY_DIR}/Third Party")
set(InstallPath "${CMAKE_BINARY_DIR}/Installed Dependencies")
# Add DocOpt
ExternalProject_Add(
DocOpt
GIT_REPOSITORY git@github.com:docopt/docopt.cpp.git
TIMEOUT 30
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${InstallPath} -DCMAKE_DEBUG_POSTFIX=d
# Wrap download, configure and build steps in a script to log output
LOG_DOWNLOAD ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON)
# Specify include dir
set(DocOptInclude ${InstallPath}/include/docopt PARENT_SCOPE)
# Specify libs
if(MSVC)
set(Suffix ".lib")
else()
set(Suffix ".a")
endif()
set(DocOptLib
debug ${InstallPath}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}docopt_sd${Suffix}
optimized ${InstallPath}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}docopt_s${Suffix}
PARENT_SCOPE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment