Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,105
    • Issues 4,105
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #16361
Closed
Open
Issue created Oct 11, 2016 by Vladimír Vondruš@mosraContributor

install() command with RUNTIME/LIBRARY/ARCHIVE DESTINATION ignores CONFIGURATIONS setting

While the following works:

add_library(MyPlugin SHARED MyPlugin.cpp)
install(TARGETS MyPlugin 
    DESTINATION lib/myplugins
    CONFIGURATIONS Debug)
install(TARGETS MyPlugin 
    DESTINATION lib/myplugins-d
    CONFIGURATIONS "" None Release RelWithDebInfo MinSizeRel)

and properly installs lib/myplugins/MyPlugin.so on Release build and lib/myplugins-d/MyPlugin.so on Debug build, when combined with RUNTIME/LIBRARY/ARCHIVE it breaks and ignores the CONFIGURATIONS settings:

add_library(MyPlugin SHARED MyPlugin.cpp)
install(TARGETS MyPlugin 
    RUNTIME DESTINATION bin/myplugins
    LIBRARY DESTINATION lib/myplugins
    ARCHIVE DESTINATION lib/myplugins
    CONFIGURATIONS Debug)
install(TARGETS MyPlugin 
    RUNTIME DESTINATION bin/myplugins-d
    LIBRARY DESTINATION lib/myplugins-d
    ARCHIVE DESTINATION lib/myplugins-d
    CONFIGURATIONS "" None Release RelWithDebInfo MinSizeRel)

resulting in both lib/myplugins/MyPlugin.so and lib/myplugins-d/MyPlugin.so being installed, regardless of which configuration type is used.

Interestingly, when specifying CONFIGURATIONS before all DESTINATION parameters, it works:

add_library(MyPlugin SHARED MyPlugin.cpp)
install(TARGETS MyPlugin 
    CONFIGURATIONS Debug
    RUNTIME DESTINATION bin/myplugins
    LIBRARY DESTINATION lib/myplugins
    ARCHIVE DESTINATION lib/myplugins)
install(TARGETS MyPlugin 
    CONFIGURATIONS "" None Release RelWithDebInfo MinSizeRel
    RUNTIME DESTINATION bin/myplugins-d
    LIBRARY DESTINATION lib/myplugins-d
    ARCHIVE DESTINATION lib/myplugins-d)

I find this inconsistent and thus a bug (because the simple case on top works properly regardless of order) and this fact is mentioned nowhere in the documentation. From a brief look in the docs it doesn't even seem that such reordering is possible.

Probably related: #14329 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking