Tom94 / tev

High dynamic range (HDR) image viewer for graphics people
BSD 3-Clause "New" or "Revised" License
1.02k stars 86 forks source link

Specify UTF-8 charset for MSVC #192

Closed chaosink closed 1 year ago

chaosink commented 1 year ago

On Windows systems with non-English locales, the UTF-8 chars may cause "Error C2001: Newline in constant".

2 solutions: Save the file with UTF-8 with BOM (byte-order mark). Specify UTF-8 charset for compilation. Used by this commit.

See discussions here: https://github.com/libusb/libusb/issues/207#issuecomment-288664124

Tom94 commented 1 year ago

This is great, thank you! Before I hit merge, could you move the code to the existing if (MSVC) block that already adds a few other flags? I'm thinking somewhere around line ~115.

chaosink commented 1 year ago

I used target_compile_options() to add the flag for target tev only. Line 115 is before where tev is added.

We may also use add_compile_options() to use the flag globally.

Tom94 commented 1 year ago

I'd prefer set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") for consistency with the other flags that are set in the block around 115.

I'm all for migrating to target_compile_options(), but imo this is better done as an all-or-nothing thing, also using target_include_directories and fixing up dependencies etc.

chaosink commented 1 year ago

Modified and force pushed. Thanks!

Tom94 commented 1 year ago

Thanks again!