[CMake] install(TARGETS) does not work with configuration-specific destinations
David Cole
DLRdave at aol.com
Tue Jun 9 11:08:15 EDT 2015
Updating the documentation for this would help... Do you have time to
propose a patch which updates the wording of the documentation to
stress the importance of parameter ordering?
On Tue, Jun 9, 2015 at 4:31 AM, Alessio <masariello+cmake.org at gmail.com> wrote:
> Ah! Specifying the CONFIGURATIONS argument *before* the DESTINATION ones
> works as intended. It would really help if the documentation was changed to
> reflect the importance of parameter ordering here.
>
> install(TARGETS ${target}
> COMPONENT ${component}
> CONFIGURATIONS Release MinSizeRel RelWithDebInfo
> RUNTIME DESTINATION
> "${${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE}"
> LIBRARY DESTINATION
> "${${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE}")
> install(TARGETS ${target}
> COMPONENT ${component}
> CONFIGURATIONS Debug PDebug
> RUNTIME DESTINATION
> "${${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG}"
> LIBRARY DESTINATION
> "${${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG}")
>
> On 8 June 2015 at 18:40, Alessio <masariello+cmake.org at gmail.com> wrote:
>>
>> I forgot to mention that, by contrast, elsewhere I have the following
>> working code. So install(FILES) seems to work fine with multiple calls for
>> different configurations.
>>
>> install(
>> FILES "$<TARGET_FILE_DIR:corelib>/some_file.txt"
>> COMPONENT platform
>> DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE}"
>> CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
>> install(
>> FILES "$<TARGET_FILE_DIR:corelib>/some_file.txt"
>> COMPONENT platform
>> DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG}"
>> CONFIGURATIONS Debug PDebug)
>>
>> On 8 June 2015 at 18:32, Alessio <masariello+cmake.org at gmail.com> wrote:
>>>
>>> Hi
>>>
>>> The below CMake code is causing my targets to get installed twice in the
>>> same tarball when I invoke cpack with the following command line
>>>
>>> "${CPACK_COMMAND}" -G ${cpack_gen} --config
>>> "${CMAKE_CURRENT_BINARY_DIR}/${package_cfg_file}" -C "$<CONFIGURATION>"
>>>
>>> The generated cmake_install.cmake in fact contains two fiel(INSTALL)
>>> sections for every target like the one at the bottom.
>>>
>>> Using \${CMAKE_INSTALL_CONFIG_NAME} as suggested in reference (1) does
>>> not quite work for me. I would like the installed directory to have a name
>>> of my choosing, rather than relying on the name of the configuration.
>>>
>>> Can this be done at all? Is there a single-call install(TARGETS)
>>> signature that gives me what I want?
>>>
>>> Thank you very much for any light you can shed on this.
>>> -alessio
>>>
>>>
>>> THE CMAKE INSTALL CODE WITH THE PROBLEM
>>> ---------------------------------------
>>> set(${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE "release")
>>> set(${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG "debug")
>>>
>>> install(TARGETS ${target}
>>> COMPONENT ${component}
>>> RUNTIME DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE}"
>>> LIBRARY DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_RELEASE}"
>>> CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
>>> install(TARGETS ${target}
>>> COMPONENT ${component}
>>> RUNTIME DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG}"
>>> LIBRARY DESTINATION "${${PROJECT_NAME}_INSTALL_RUNTIME_DEBUG}"
>>> CONFIGURATIONS Debug PDebug)
>>>
>>>
>>>
>>> SAMPLE cmake_install.cmake SECTION
>>> ----------------------------------
>>> if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL
>>> "platform")
>>> if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")
>>> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release" TYPE
>>> SHARED_LIBRARY FILES "E:/Views/build/testapp/Debug/testapp-d.dll")
>>> elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES
>>> "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
>>> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release" TYPE
>>> SHARED_LIBRARY FILES "E:/Views/build/testapp/Release/testapp.dll")
>>> elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES
>>> "^([Mm][Ii][Nn][Ss][Ii][Zz][Ee][Rr][Ee][Ll])$")
>>> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release" TYPE
>>> SHARED_LIBRARY FILES "E:/Views/build/testapp/MinSizeRel/testapp-ms.dll")
>>> elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES
>>> "^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$")
>>> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release" TYPE
>>> SHARED_LIBRARY FILES "E:/Views/build/testapp/RelWithDebInfo/testapp-rd.dll")
>>> elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES
>>> "^([Pp][Dd][Ee][Bb][Uu][Gg])$")
>>> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release" TYPE
>>> SHARED_LIBRARY FILES "E:/Views/build/testapp/PDebug/testapp-pd.dll")
>>> endif()
>>> endif()
>>>
>>>
>>> REFERENCES
>>> ----------
>>> (1) http://www.cmake.org/pipermail/cmake/2010-May/036979.html
>>
>>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
More information about the CMake
mailing list