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,818
    • Issues 3,818
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • 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
  • #23043
Closed
Open
Created Dec 21, 2021 by Esteban Papp@amznestebanpapp

VS: Mutliple add_library of INTERFACE targets with source files in the same CMakeLists.txt can produce MSB8028 (Visual Studio generator)

Found this edge case...

We have two libraries in one CMakeList.txt file that are INTERFACE targets with source files. After CMake version 3.19, targets are being created (stated in the documentation https://cmake.org/cmake/help/latest/command/add_library.html#interface-libraries)

The Visual Studio generator does not add an "IntDir" to the project file being generated. This is due to the first conditional in cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions:

  if (ttype > cmStateEnums::GLOBAL_TARGET) {
    return;
  }

When two targets of this type are declared in the same CMakeLists.txt, Visual Studio will assume a default IntDir, which does not depend on the target name itself, but on the folder where the target is, in our case is x64\profile. When building, warning MSB8028 gets produced because the two targets are sharing the same intermediate directory. In our case there is no file in the intermediate folder that has the same name across targets, only tlog and recipe files are there and they are named after the target, so the warning is not an issue. However, it would be nice to get IntDir generated similarly to other targets to avoid the warning.

Edited Jan 11, 2022 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking