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 18
    • Merge requests 18
  • 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
  • #22089
Closed
Open
Issue created Apr 21, 2021 by Jan Krassnigg@Jan42

C# LangVersion options only available up to version 6

You can specify the C# language version to use through target_compile_options(${TARGET_NAME} PRIVATE "/langversion:X")

I noticed that only these C# LangVersion property values are currently available: "3, 4, 5, 6, default". Possible values seem to be defined in Templates\MSBuild\FlagTables\v142_CSharp.json

There are apparently quite a few more versions by now: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/language

For my build I need at least version 7. The work around is to either use "default" or to not specify this option at all. target_compile_options(${TARGET_NAME} PRIVATE "/langversion:default")

Both ways will effectively unlock the latest major version number.

That's good enough for me (and probably most people). However, I was modifying an existing CMakeLists.txt which had version set to "6" for by now outdated reasons, and I was wondering why changing it to "7" didn't work. Since I could only figure out the reason by looking at the CMake code, I thought I at least let you know and make this easier for people to find through Google.

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