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

Closed
Open
Created Nov 13, 2019 by Oleg Gubanov@guban

VS: Providing the `/AI` compiler option results in two `<AdditionalUsingDirectories>` elements

I have a managed C++ target AAA that depends on a native C++ static library BBB and another managed C++ target CCC. In AAA, I must use CCC as friend:

#using "CCC.dll" as_friend

For this to work, I need to provide CCC.dll's folder with /AI compiler option:

target_compile_options(AAA PRIVATE /AI"${CMAKE_BINARY_DIR}/bin")

In the generated project file AAA.vcxproj, I expect to see the <AdditionalUsingDirectories> XML element that contains the expanded value of "${CMAKE_BINARY_DIR}/bin". And I do see it, but then in the same <ClCompile> XML element there is the second <AdditionalUsingDirectories> XML element that contains the library directory of BBB. This second <AdditionalUsingDirectories> overwrites the folder that I set with /AI compiler option. The #using statement results in compilation errors, and there seems to be no way to fix the problem from my CMakeLists.txt.

The expected behavior would be to generate one <AdditionalUsingDirectories> XML element that merges paths coming from my /AI option and paths coming from dependencies.

Edited Jun 22, 2020 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