CMake: Fix issue that led to Windows Unicode support still defaulting to off #1594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up from #1363
In that PR, a CMake option was introduced called
OCIO_USE_WINDOWS_UNICODE
to allow users to compile either an ANSI-only or Unicode build on Windows. Its default value was set toWIN32
in an attempt to automatically enable on Windows and disable on other platforms.It turns out there's a syntax issue here, CMake sets it to the literal string
"WIN32"
rather than the value of the variable${WIN32}
, and it considers that string literal equivalent toOFF
at all times.This could be corrected by simply changing the default value to
${WIN32}
instead ofWIN32
, which I've tested and works correctly, however what I've written in this PR is a wrapping of that CMake option in anif (WIN32)
and defaulting the option toON
. Personally, I prefer this approach because I think the code is more readable and there's no real point for a Windows-only option being visible/available on non-Windows platforms anyway. However, if the former approach is preferred, I can write that in instead.