project: Different behavior between runs when setting project variables
Because of the regression highlighted in #26281, the change in !9820 was made with the intention that it would only set non-cache project variables if a non-cache variable did not already exist at the time of the `project()` call. Unfortunately, that fix itself contained a bug. It called `IsDefinitionSet()` instead of `IsNormalDefinitionSet()` when checking if a variable already exists, so it also considers whether a _cache_ variable is set. This was not the intended behavior, and unfortunately we only see the bug if we re-run CMake a second time. On the first run, we get the intended behavior because no cache variable exists yet. On the second run, the cache variables do exist and the call to `IsDefinitionSet()` will return a different result to what it did on the first run. This means !9820 only fixes #26281 for the first run, but not for subsequent runs.
issue