if(PROJECT_ENABLE_CXXOPTS)
  if(PROJECT_BUILD)
    add_definitions(-DPROJECT_ENABLE_CXXOPTS)
  elseif(NOT PROJECT_IS_MINGW OR CMAKE_HOST_WIN32)
    ExternalProject_Add(cxxopts_project
      PREFIX external
      URL ${PROJECT_3RD_PARTY_DIR}/cxxopts-v${CXXOPTS_VERSION}.tar.gz
      URL_HASH SHA256=${CXXOPTS_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}
        -DCXXOPTS_BUILD_EXAMPLES=OFF
        -DCXXOPTS_BUILD_TESTS=OFF
        -DCXXOPTS_ENABLE_INSTALL=ON
        -DCXXOPTS_ENABLE_WARNINGS=OFF
        -DCXXOPTS_USE_UNICODE_HELP=ON
    )

    list(APPEND PROJECT_DEPENDENCIES cxxopts_project)
  endif()
endif()
