[CMake] install(EXPORT ...) behavior for multi-configuration generators
Gregoire Aujay
gaujay at movea.com
Mon Jan 7 12:56:47 EST 2013
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/20130107/d3d736bc/attachment.htm>
More information about the CMake
mailing list