I’m using the following fragments to install targets and exports in a number of projects.
install(TARGETS myproj EXPORT myproj
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
)
if(MYPROJ_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()
This has worked literally for the last years. Until recently I got an error message from a user that used CMake 3.19.1
```
-- Configuring done
CMake Error: install(EXPORT "myproj" ...) includes target "myproj" more than once in the export set.
-- Generating done
```
Is the error on my side and I should avoid repeating the EXPORT myproj
part when building shared libraries or is that a regression in 3.19.1?
Thanks in advance, Cheers Volker