vcpkg/docs/maintainers/vcpkg_fixup_cmake_targets.md
nicole mazzuca 3426db05b9
[scripts-audit] Rollup PR 2021-02-26 (#16440)
* [scripts-audit rollup] PR #16419

* pull the cmake doc comment parsing out into its own function
* support cmake helper ports
* add real support for deprecation, as opposed to ad-hoc

* [scripts-audit rollup] PR #16192

* add a z_ in front of internal functions
* move internal functions out

set feature_vars again in parent scope

* [scripts-audit rollup] PR #16309

Audit vcpkg_copy_pdbs

* [scripts-audit rollup] PR #16304

* Fix usage, documentation

* [scripts-audit rollup] PR #16393

* [scripts-audit rollup] PR #16377

Deprecate `vcpkg_*_cmake` in favor of `vcpkg_cmake_*` from the
`vcpkg-cmake` port, as well as `vcpkg_fixup_cmake_targets`
in favor of `vcpkg_cmake_config_fixup` from the
`vcpkg-cmake-config` port.
2021-02-28 13:17:19 -08:00

2.5 KiB

vcpkg_fixup_cmake_targets

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

This function has been deprecated in favor of vcpkg_cmake_config_fixup from the vcpkg-cmake-config port.

Merge release and debug CMake targets and configs to support multiconfig generators.

Additionally corrects common issues with targets, such as absolute paths and incorrectly placed binaries.

Usage

vcpkg_fixup_cmake_targets([CONFIG_PATH <share/${PORT}>] [TARGET_PATH <share/${PORT}>] [DO_NOT_DELETE_PARENT_CONFIG_PATH])

Parameters

CONFIG_PATH

Subpath currently containing *.cmake files subdirectory (like lib/cmake/${PORT}). Should be relative to ${CURRENT_PACKAGES_DIR}.

Defaults to share/${PORT}.

TARGET_PATH

Subpath to which the above *.cmake files should be moved. Should be relative to ${CURRENT_PACKAGES_DIR}. This needs to be specified if the port name differs from the find_package() name.

Defaults to share/${PORT}.

DO_NOT_DELETE_PARENT_CONFIG_PATH

By default the parent directory of CONFIG_PATH is removed if it is named "cmake". Passing this option disable such behavior, as it is convenient for ports that install more than one CMake package configuration file.

NO_PREFIX_CORRECTION

Disables the correction of_IMPORT_PREFIX done by vcpkg due to moving the targets. Currently the correction does not take into account how the files are moved and applies I rather simply correction which in some cases will yield the wrong results.

Notes

Transform all /debug/<CONFIG_PATH>/*targets-debug.cmake files and move them to /<TARGET_PATH>. Removes all /debug/<CONFIG_PATH>/*targets.cmake and /debug/<CONFIG_PATH>/*config.cmake.

Transform all references matching /bin/*.exe to /tools/<port>/*.exe on Windows. Transform all references matching /bin/* to /tools/<port>/* on other platforms.

Fix ${_IMPORT_PREFIX} in auto generated targets to be one folder deeper. Replace ${CURRENT_INSTALLED_DIR} with ${_IMPORT_PREFIX} in configs and targets.

Examples

Source

scripts/cmake/vcpkg_fixup_cmake_targets.cmake