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,107
    • Issues 4,107
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • 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
  • #21743
Closed
Open
Issue created Jan 26, 2021 by Bobby Reynolds@reynoldsbdContributor

vs_link_exe interferes with RULE_LAUNCH_LINK on Windows

I am trying to integrate a static analysis tool into my team's build. The tool works similarly to ccache by wrapping and instrumenting compiler and linker invocations:

myanalyzer <analysis args> cl.exe file.cpp ...
myanalyzer <analysis args> link.exe ...

The RULE_LAUNCH_COMPILE and RULE_LAUNCH_LINK properties seem a perfect fit for this scenario, and indeed adding my analysis command to RULE_LAUNCH_COMPILE works perfectly and allows me to instrument and analyze all the compiler invocations in my build.

However, instrumenting linker calls is proving to be quite difficult. The issue is that, on Windows, CMake generates calls to an internal wrapper command rather than to link.exe itself. So when I specify a launcher command using RULE_LAUNCH_LINK, the build system ends up running this command:

myanalyzer <analysis args> cmake.exe -E vs_link_exe <wrapper args> -- link.exe ...

This causes myanlayzer to fail because it cannot interpret the linker command line. Intuitively, I would have expected my launcher command to be placed after the -- but before link.exe:

cmake.exe -E vs_link_exe <wrapper args> -- myanalyzer <analysis args> link.exe ...

Is there some easy way to achieve this? Or some way to bypass the vs_link_exe wrapper altogether?

(For what it's worth, I'm using the Ninja generator.)

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