vcpkg/docs/maintainers/vcpkg_fixup_cmake_targets.md
Silvio Traversaro 70ab27fcad
[ignition-plugin1] Add new port 🤖 (#11275)
* [ignition-plugin1] Add new port

* vcpkg_fixup_cmake_targets: Add DO_NOT_DELETE_PARENT_CONFIG_PATH

By default the vcpkg_fixup_cmake_targets script remove the parent
path of CONFIG_PATH if it named "cmake", this behaviour is not convenient
for ports that install more than one CMake package config file, and
for which vcpkg_fixup_cmake_targets is invoked multiple times.
To optionally disable this behaviour, this commit adds the option
DO_NOT_DELETE_PARENT_CONFIG_PATH to vcpkg_fixup_cmake_targets.

* [ignition-modularscripts] Add support for ignition libraries that install multiple CMake package config files

Some ignition libraries install several CMake  package config files,
to represent the different components of the library. This  commit modifies
the ignition_modular_library function to fixup correctly all the cmake package config files.

* vcpkg_fixup_pkgconfig: Move definition of SYSTEM_LIBRARIES to vcpkg_common_definitions

To correctly validate installed pkg-config files, vcpkg_fixup_pkgconfig needs to know
for each platform which libraries are not managed by vcpkg. This commits improve this
definitions for all the triplet supported by vcpkg, and move this definition to vcpkg_common_definitions
in a way that permit custom triplets to overload its value.
2020-06-24 14:59:32 -07:00

48 lines
2.0 KiB
Markdown

# vcpkg_fixup_cmake_targets
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
```cmake
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.
## 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
* [concurrentqueue](https://github.com/Microsoft/vcpkg/blob/master/ports/concurrentqueue/portfile.cmake)
* [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake)
* [nlohmann-json](https://github.com/Microsoft/vcpkg/blob/master/ports/nlohmann-json/portfile.cmake)
## Source
[scripts/cmake/vcpkg_fixup_cmake_targets.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_fixup_cmake_targets.cmake)