# Exporting renamed/multiple-named configs

**URL:** https://discourse.cmake.org/t/exporting-renamed-multiple-named-configs/2586
**Category:** Code
**Created:** [January 20, 2021, 9:50am UTC](https://discourse.cmake.org/t/exporting-renamed-multiple-named-configs/2586 "2021-01-20T09:50:11Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 20, 2021, 3:33pm UTC](https://discourse.cmake.org/t/exporting-renamed-multiple-named-configs/2586/2 "2021-01-20T15:33:36Z")

</div>

I would hand-code the `OldName` package to do forwarding. Something like this logic is used in VTK for [deprecated components](https://gitlab.kitware.com/vtk/vtk/-/blob/e310c3e9d19916a7d41412deea0240020179e928/CMake/vtk-config.cmake.in#L69-82) and [deprecating `VTK_USE_FILE`](https://gitlab.kitware.com/vtk/vtk/-/blob/e310c3e9d19916a7d41412deea0240020179e928/CMake/vtk-config.cmake.in#L313-320). So, basically:

- if there’s no minimum version requested, make deprecation warnings about the changes
- if a version before the change is requested, stay quiet (because they need to do that in order to keep their minimum there); an `AUTHOR_WARNING` may be appropriate to let the developers know that things are afoot though
- if a version with the new stuff is requested, error so that they migrate to the new names

Then I would provide targets under the old name:

```cmake
find_package(NewName) # Forward arguments like `QUIET`, components, and/or version requests too
if (NOT NewName_FOUND)
  set(OldName_FOUND 0)
  set(OldName_NOT_FOUND_MESSAGE "NewName not found: ${NewName_NOT_FOUND_MESSAGE}")
  return ()
endif ()

if (NOT TARGET OldName::OldTarget AND TARGET NewName::NewTarget)
  add_library(OldName::OldTarget IMPORTED INTERFACE)
  set_target_properties(OldName::OldTarget PROPERTIES INTERFACE_LINK_LIBRARIES "NewName::NewTarget")
endif ()

```

---

_[View the full topic](https://discourse.cmake.org/t/exporting-renamed-multiple-named-configs/2586)._
