[CMake] Windows Visual Studio Install Configurations unexpected behaviour
Dominic Walsh
DWalsh2 at slb.com
Wed Oct 30 04:30:13 EDT 2013
Hi
I am attempting to "make install" into configuration dependent directories. Linux works very straightforwardly but VS not so much.
After much searching my CMakeLists file includes:
INSTALL(TARGETS bob
RUNTIME DESTINATION ${INSTALL_LIB_PATH}/Debug
LIBRARY DESTINATION ${INSTALL_LIB_PATH}/Debug
ARCHIVE DESTINATION ${INSTALL_LIB_PATH}/Debug
CONFIGURATIONS Debug)
INSTALL(TARGETS bob
RUNTIME DESTINATION ${INSTALL_LIB_PATH}/Release
LIBRARY DESTINATION ${INSTALL_LIB_PATH}/Release
ARCHIVE DESTINATION ${INSTALL_LIB_PATH}/Release
CONFIGURATIONS Release)
Which is doing a little more than expected e.g.
3>PostBuildEvent:
3> -- Install configuration: "Debug"
3> -- Installing: <snip>/pc/x64_vs100/bob/lib/Debug/bob.lib
3> -- Installing: <snip>/pc/x64_vs100/bob/lib/Debug/bob.dll
3> -- Up-to-date: <snip>/pc/x64_vs100/bob/lib/Release/bob.dll
This final line was not expected. Looking at the cmake_install.cmake I can see the appropriate section:
IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
IF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES
"<snip>Libraries/pc/x64_vs100/bob/lib/Release/bob.dll")
IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)
message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)
IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)
message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)
FILE(INSTALL DESTINATION "<snip>Libraries/pc/x64_vs100/bob/lib/Release" TYPE SHARED_LIBRARY FILES "<snip>Libraries/src/bob/Debug/bob.dll")
Where the configuration "Debug" has an install into the "Release" area?
I am using version 2.8.8 but have also found the same with 2.8.12.
I can write a custom post-build command but would like to understand,
thanks
Dominic
More information about the CMake
mailing list