vcpkg/docs/maintainers/vcpkg_cmake_build.md
Robert Schumacher 23cc58477e
[docs] Rewrite docs for vcpkg_cmake_build and vcpkg_cmake_install (#25477)
* [docs] Rewrite docs for vcpkg_cmake_build and vcpkg_cmake_install

* [docs] Fix broken links

* [docs] Add notes about parent helper port
2022-08-16 15:51:42 -07:00

2.1 KiB

vcpkg_cmake_build

The latest version of this document lives in the vcpkg repo.

Build a cmake project with a custom install target.

Conventionally, CMake uses the target install to build and copy binaries into the CMAKE_INSTALL_PREFIX. In rare circumstances, a project might have more specific targets that should be used instead.

Ports should prefer calling vcpkg_cmake_install() when possible.

Usage

vcpkg_cmake_build(
    [TARGET <target>]
    [LOGFILE_BASE <base>]
    [DISABLE_PARALLEL]
    [ADD_BIN_TO_PATH]
)

To use this function, you must depend on the helper port vcpkg-cmake:

"dependencies": [
  {
    "name": "vcpkg-cmake",
    "host": true
  }
]

Parameters

All supported parameters to vcpkg_cmake_install() are supported by vcpkg_cmake_build(). See vcpkg_cmake_install() for additional parameter documentation.

TARGET

The CMake target to build.

If this parameter is not passed, no target will be passed to the build.

LOGFILE_BASE

An alternate root name for the logs.

Defaults to build-${TARGET_TRIPLET}. It should not contain any path separators. Logs will be generated matching the pattern ${CURRENT_BUILDTREES_DIR}/${LOGFILE_BASE}-<suffix>.log

Examples

vcpkg_from_github(OUT_SOURCE_PATH source_path ...)
vcpkg_cmake_configure(
    SOURCE_PATH "${source_path}"
    OPTIONS
        -DBUILD_EXAMPLES=OFF
        -DBUILD_TESTS=OFF
)
vcpkg_cmake_build(TARGET my.install.target)

Search microsoft/vcpkg for Examples

Remarks

This command replaces vcpkg_build_cmake().

Source

ports/vcpkg-cmake/vcpkg_cmake_build.cmake