if(PROJECT_ENABLE_CLI11)
  if(PROJECT_BUILD)
    add_definitions(-DPROJECT_ENABLE_CLI11)

    find_package(CLI11 ${CLI11_VERSION} REQUIRED)
  elseif(NOT PROJECT_IS_MINGW)
    ExternalProject_Add(cli11_project
      PREFIX external
      URL ${PROJECT_3RD_PARTY_DIR}/CLI11-${CLI11_VERSION}.tar.gz
      URL_HASH SHA256=${CLI11_HASH}
      LIST_SEPARATOR |
      CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
        -DBUILD_SHARED_LIBS=${PROJECT_BUILD_SHARED_LIBS}
        -DBUILD_STATIC_LIBS=ON
        -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
        -DCLI11_WARNINGS_AS_ERRORS=OFF
        -DCLI11_SINGLE_FILE=ON
        -DCLI11_BUILD_DOCS=OFF
        -DCLI11_BUILD_TESTS=OFF
        -DCLI11_BUILD_EXAMPLES=OFF
        -DCLI11_INSTALL=ON
    )

    list(APPEND PROJECT_DEPENDENCIES cli11_project)
  endif()
endif()
