本文档翻译自:https://docs.conan.io/en/latest/reference/commands/creator/new.html

    1. $ conan new [-h] [-t] [-i] [-c] [-s] [-b] [-m TEMPLATE] [-cis] [-cilg]
    2. [-cilc] [-cio] [-ciw] [-ciglg] [-ciglc] [-ciccg] [-ciccc]
    3. [-cicco] [-gi] [-ciu CI_UPLOAD_URL]
    4. name

    使用“ conanfile.py”和可选的“ test_package”测试文件创建一个新的包装配方模板。

    1. positional arguments:
    2. name Package name, e.g.: "poco/1.9.4" or complete reference
    3. for CI scripts: "poco/1.9.4@user/channel"
    4. optional arguments:
    5. -h, --help show this help message and exit
    6. -t, --test Create test_package skeleton to test package
    7. -i, --header Create a headers only package template
    8. -c, --pure-c Create a C language package only package, deleting
    9. "self.settings.compiler.libcxx" setting in the
    10. configure method
    11. -s, --sources Create a package with embedded sources in "src"
    12. folder, using "exports_sources" instead of retrieving
    13. external code with the "source()" method
    14. -b, --bare Create the minimum package recipe, without build()
    15. method. Useful in combination with "export-pkg"
    16. command
    17. -m TEMPLATE, --template TEMPLATE
    18. Use the given template from the local cache for
    19. conanfile.py
    20. -cis, --ci-shared Package will have a "shared" option to be used in CI
    21. -cilg, --ci-travis-gcc
    22. Generate travis-ci files for linux gcc
    23. -cilc, --ci-travis-clang
    24. Generate travis-ci files for linux clang
    25. -cio, --ci-travis-osx
    26. Generate travis-ci files for OSX apple-clang
    27. -ciw, --ci-appveyor-win
    28. Generate appveyor files for Appveyor Visual Studio
    29. -ciglg, --ci-gitlab-gcc
    30. Generate GitLab files for linux gcc
    31. -ciglc, --ci-gitlab-clang
    32. Generate GitLab files for linux clang
    33. -ciccg, --ci-circleci-gcc
    34. Generate CircleCI files for linux gcc
    35. -ciccc, --ci-circleci-clang
    36. Generate CircleCI files for linux clang
    37. -cicco, --ci-circleci-osx
    38. Generate CircleCI files for OSX apple-clang
    39. -gi, --gitignore Generate a .gitignore with the known patterns to
    40. excluded
    41. -ciu CI_UPLOAD_URL, --ci-upload-url CI_UPLOAD_URL
    42. Define URL of the repository to upload

    Examples:
    为新软件包mypackage/1.0@myuser/stable创建一个新的conanfile.py

    1. $ conan new mypackage/1.0

    还创建一个test_package文件夹框架:

    1. $ conan new mypackage/1.0 -t

    为travis(Linux和OSX)和Appveyor持续集成创建文件:

    1. $ conan new mypackage/1.0@myuser/stable -t -cilg -cio -ciw

    为gitlab创建文件(linux)持续集成并设置上载柯南服务器:

    1. $ conan new mypackage/1.0@myuser/stable -t -ciglg -ciglc -ciu https://api.bintray.com/conan/myuser/myrepo

    从自定义,预定义的用户模板配方或模板目录创建文件:

    1. $ conan new mypackage/1.0 --template=myconanfile.py # Single template file
    2. $ conan new mypackage/1.0 --template=header_only # Template directory

    有关这些模板的更多信息,请参阅“ conan new命令的封装脚手架”部分。