# Managing namelink install target export

**URL:** <https://discourse.cmake.org/t/managing-namelink-install-target-export/3134>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [April 13, 2021, 10:12am UTC](https://discourse.cmake.org/t/managing-namelink-install-target-export/3134 "2021-04-13T10:12:22Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![vre](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@vre](https://discourse.cmake.org/u/vre)\
**Post date:** [April 13, 2021, 12:25pm UTC](https://discourse.cmake.org/t/managing-namelink-install-target-export/3134/5 "2021-04-13T12:25:17Z")

</div>

You may have a look onto [this](https://discourse.cmake.org/t/error-when-installing-targets-and-exports-in-3-19-1/2245) discussion. We solved it the following way:

```
  if(NOT CMAKE_VERSION VERSION_LESS 3.12)
    install(TARGETS myProj EXPORT myProj
      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_COMPONENT development
      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
      RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR} COMPONENT development
    )
    if(BUILD_SHARED_LIBS)
      if(MSVC)
        install(FILES $<TARGET_PDB_FILE:myProj> DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug)
      endif()
    endif()
  else()
    install(TARGETS myProj EXPORT myProj
      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP
      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
      RESOURCE DESTINATION ${CMAKE_INSTALL_DATADIR} COMPONENT development
    )
    if(BUILD_SHARED_LIBS)
      install(TARGETS myProj EXPORT myProj LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development NAMELINK_ONLY)
      if(MSVC)
        install(FILES $<TARGET_PDB_FILE:myProj> DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug)
      endif()
    endif()
  endif()
```

---

_[View the full topic](https://discourse.cmake.org/t/managing-namelink-install-target-export/3134)._
