Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

CMake issues with Visual Studio Ninja generator

Open slipher opened this issue 5 years ago • 2 comments

There is a Ninja-based generator for Visual studio, which is used if you create a project using Visual Studio's CMake integration. There are issues with it because the CONFIG generator expression has a different meaning than in other generators. Normally it is equal to one of the possible values for CMAKE_BUILD_TYPE. But in the VS Ninja generator, it is an arbitrary name.

This issue is not very important to solve, but I am writing some notes in case it comes up.

Possible workarounds:

  1. Use an external CMake install to create VS projects with the classic generator (I am doing this).
  2. Set USE_PRECOMPILED_HEADERS and BUILD_GAME_NACL to 0, which will avoid the two places where this generator expression variable is used.

It might be possible to fix by making variables to evaluate to whether the build type is equal to [foo] in generator expressions, which would be $<CONFIG:foo> or the result of ${CMAKE_BUILD_TYPE} EQ foo depending on which generator is being used.

slipher avatar Nov 20 '20 22:11 slipher

I suppose the precompiled headers error is a moot point, since they don't work on Ninja anyway.

slipher avatar Nov 21 '23 01:11 slipher

Besides the NaCl bit there's one more use of CONFIG generator expressions - adding the DEBUG_BUILD define.

slipher avatar Nov 30 '23 00:11 slipher