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,800
    • Issues 3,800
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 14
    • Merge requests 14
  • 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
  • #16960

Closed
Open
Created Jun 12, 2017 by Mark Stijnman@mark.stijnman

add_custom_command(OUTPUT ...) doesn't work in C# projects

I've been playing with the new (and very welcome) C# support, but I've found that add_custom_command doesn't work for C# projects. I want to use this to generate source files for version and build date information, like I do for my C++ projects. The <CustomBuild> entries for the add_custom_command are created in the csproj file, but they never run. As a consequence, the C# build fails with an error that the .cs file is not found.

See the attached zip file for a minimal example, which demonstrates that the identical approach works for C++, but not in C#.

Note that because of this, the custom CMakeLists.txt rule ("Building Custom Rule C:/.../src/CMakeLists.txt") doesn't appear to run either.

example.zip

Edited Jun 13, 2017 by Michael Stürmer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking