[CMake] install(EXPORT ...) behavior for multi-configuration generators

Gregoire Aujay gaujay at movea.com
Mon Jun 10 11:28:49 EDT 2013


Hello,

Can someone help me with this issue, see description below.
I had to disable install(EXPORT ...) when using multi-configuration generators. This leads to errors for people using one of them.

Issue is that I cannot export targets that are installed in different locations (one for debug, another one for release) with multi-conf generators.


Regards,
Gregoire



From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Gregoire Aujay
Sent: lundi 7 janvier 2013 18:57
To: cmake at cmake.org
Subject: [CMake] install(EXPORT ...) behavior for multi-configuration generators

Hello,

I am using CMake 2.8.10.2, on windows.
I am trying to use install(TARGETS ) and install(EXPORT ) both with NMake makefiles and with the multi-configuration generator Visual studio.
I cannot get the same behavior when I want my binaries to be installed in a subfolder that depends on the configuration, e.g. :

-          Debug/bin/myLib.dll

-          Release/bin/myLib.dll

If I do that :
#start
install(TARGETS "myLib" EXPORT " myTargets "
                ARCHIVE DESTINATION   "\${CMAKE_INSTALL_CONFIG_NAME}/lib"
                LIBRARY DESTINATION    "\${CMAKE_INSTALL_CONFIG_NAME}/lib"
                RUNTIME DESTINATION "\${CMAKE_INSTALL_CONFIG_NAME}/bin"
)
install(EXPORT "myTargets" DESTINATION "cmake")
#end

This works find for NMake and Visual for install rules because ${CMAKE_INSTALL_CONFIG_NAME} will be evaluated at install time.
But in my myTargets-debug.cmake import files, ${CMAKE_INSTALL_CONFIG_NAME} will not be evaluated correctly.


Now If I do that:
#start
install(TARGETS "myLib" EXPORT " myTargets "
                ARCHIVE DESTINATION   "Debug/lib"
                LIBRARY DESTINATION    "Debug/lib"
                RUNTIME DESTINATION "Debug/bin"
CONFIGURATIONS Debug
)
install(TARGETS "myLib" EXPORT " myTargets "
                ARCHIVE DESTINATION   "Release/lib"
                LIBRARY DESTINATION    "Release/lib"
                RUNTIME DESTINATION "Release/bin"
CONFIGURATIONS Release
)

install(EXPORT "myTargets" DESTINATION "cmake")
# end

CMake will complain that:
CMake Error: INSTALL(EXPORT " myTargets " ...) includes target " myLib " more than once in the export set.



Is this a bug that CMake complains about a target being exported twice but with different configurations?
Does anyone have a workaround?

Regards,
Gregoire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130610/e2a8e66c/attachment.htm>


More information about the CMake mailing list