Skip to content

GitLab

  • Menu
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 3,823
    • Issues 3,823
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & 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
  • CMake
  • CMakeCMake
  • Issues
  • #20044
Closed
Open
Created Nov 29, 2019 by Stephen Kelly@steveireDeveloper

VS_DEBUGGER_ENVIRONMENT should have an INTERFACE_ variant for usage requirements

As of CMake 3.13 I can build an executable which uses Qt5 and be able to debug it in Visual Studio like this:

cmake_minimum_required(VERSION 3.13)

project(cmaketest)

find_package(Qt5Widgets REQUIRED)

add_executable(mn main.cpp)
target_link_libraries(mn PRIVATE Qt5::Widgets)
set(targetPath
    "%PATH%;$<TARGET_FILE_DIR:Qt5::Widgets>;${otherPaths}")
set(targetEnvSep "\n")
set_property(TARGET mn PROPERTY
    VS_DEBUGGER_ENVIRONMENT "PATH=${targetPath}${targetEnvSep}QT_PLUGIN_PATH=/path/to/Qt/plugins"
)

The VS_DEBUGGER_ENVIRONMENT is useful, but it is not convenient to use in a large project because the feature lacks transitive usage requirements.

The Qt5 imported targets (and any targets) should be able to provide some expression of a usage requirement for this feature. CMake should consume the INTERFACE property and apply it to executables.

A possible design is for INTERFACE_VS_DEBUGGER_ENVIRONMENT_<ENVVAR> target properties to be populated and for CMake to aggregate them as needed. Two dependencies should be able to set different INTERFACE_VS_DEBUGGER_ENVIRONMENT_PATH content and have that combined into a single PATH setting in the VS_DEBUGGER_ENVIRONMENT content. Qt needs to be able to set QT_PLUGIN_PATH, and other dependencies might have similar requirements.

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