[CMake] Unicode path wrecks havoc with VS2013 generator

Clinton Stimpson clinton at elemtech.com
Wed Nov 13 11:26:53 EST 2013


On Wednesday, November 13, 2013 03:12:13 PM Nagy-Egri Máté Ferenc wrote:
> I have changed the encoding as you suggested and the project compiled fine:
> 
> 
> 1>------ Build started: Project: cmTryCompileExec747919577, Configuration:
> Debug Win32 ------
 1>  Microsoft (R) C/C++ Optimizing Compiler Version
> 18.00.21005.1 for x86 1>  Copyright (C) Microsoft Corporation.  All rights
> reserved.
> 1>  
> 1>  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D
> "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise
> /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec747919577.dir\Debug\\"
> /Fd"cmTryCompileExec747919577.dir\Debug\vc120.pdb" /Gd /TC /analyze-
> /errorReport:prompt testCCompiler.c
 1>
> 1>  testCCompiler.c
> 1>  cmTryCompileExec747919577.vcxproj ->
> C:\Users\MátéFerenc\SkyDrive\Develop\Active\GridRipper\VS2013\CMakeFiles\CM
> akeTmp\Debug\cmTryCompileExec747919577.exe
 ========== Build: 1 succeeded, 0
> failed, 0 up-to-date, 0 skipped ========== 
> 
> 
> If you could issue a patch (2.8.12.2 if I’m not mistaken) that would correct
> this bug, that would simply rock.

A 2.8.12.2 will only be created if there was a serious regression in 2.8.12 or 
2.8.12.1.

Your problem is not a regression.

 
> 
> Cheers,
> 
> Máté
> 
> 
> ps.: Anyone has an idea what causes this issue with UTF-8?

CMake wrote the project file with the Windows-1252 encoding, so it isn't really 
a utf-8 file.

> As far as I saw
> from the sources, the project files are concatenated from instances of
> std:: string. Wouldn’t std:: wstring solve the problem?

No.  Both std::string and std::wstring have no concept of a built in encoding.
One could choose to use std::string to store either utf-8 or Windows-1252 or 
any other encoding.
One could choose to use std::wstring to store UTF-16, UTF-32 or any other 
encoding.

Clint

> Or using the ICU
> library perhaps? (I’m fine as long as the patch fixes my problems, the
> question is just out of curiosity)
 
> 
> 
> 
> Feladó: clinton at elemtech.com
> Elküldve: ‎szerda‎, ‎2013‎. ‎november‎ ‎13‎. ‎15‎:‎23
> Címzett: cmake at cmake.org
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I have tried to open the solution by the IDE itself, but that fails to load
> the solution also. It report the same error while trying to load the
> projects inside.
 
> 
> 
> 
> Shall I rebuild CMake with the mentioned patch to make it work, or can I
> hope of a patch that solves this problem?
 
> You can manually edit the visual studio project file to replace "utf-8" with
> "Windows-1252" (or whatever is appropriate for your language) and load the
> project in visual studio.
 
> 
> 
> 
> If that works, can you please modify cmVisualStudio10TargetGenerator.cxx to
> change from "utf-8" to "Windows-1252" to see if you can build the rest of
> your project.
 
> Let us know so we can include a fix.
> 
> 
> 
> 
> Clint
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Feladó: clinton at elemtech.com
> Elküldve: ‎szombat‎, ‎2013‎. ‎november‎ ‎9‎. ‎7‎:‎14
> Címzett: cmake at cmake.org
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ----- Original Message -----
> 
> > On 11/8/2013 4:48 AM, Nagy-Egri Máté Ferenc wrote:
> > 
> > > Hi!
> > >
> > >
> > >
> > > I have the following issue, which I do not know whether it is an issue
> > > of CMake or Visual Studio. When I try to generate a Visual Studio
> > > project under a path that contains unicode characters, VS fails to
> > > compile the simple test file and thus CMake terminates project
> > > generation. Visual Studio does have some issues with projects under
> > > unicode paths, but generally things work. (For eg. the C++AMP call tree
> > > generator breaks, therefore no C++AMP project can be built in such
> > > paths) I develop all my applications in my Skydrive folder which is
> > > under the Users folder, and since my name holds unicode characters, I
> > > have no control over mw home folder under Win 8 if I have a Live-ID
> > > user
> > > in the OS. This is what happens:
> > 
> > Clearly you need to change your name.  :)
> > 
> > Can you create a simple project from the IDE in that directory and get
> > it to work?
> > 
> > If you run CMake with --debug-trycompile, can you load the solution in
> > the CMakeTmp directory from the IDE?
> > 
> 
> 
> 
> 
> This problem can also be reproduced with English as the current language.
> Just pick a character between 128 and 256 to include in the name of the
> build directory.
 For example, buildñ, and run cmake in there pointing to
> any source tree. 
> 
> 
> For me, the Visual Studio 9 2008 generator works fine and the project file
> reports an encoding of Windows-1252.
 It fails with the the Visual Studio
> 10 generator where the project file reports a utf-8 encoding, but it really
> isn't utf-8. So I get errors like this:
>  C:\...\cmake\buildñ\CMakeFiles\CMakeTmp\cmTryCompileExec926
> 91608.vcxproj(56,110):
>  error MSB4025: The project file could not be loaded.  Invalid character in
> the given encoding.  Line 56, position 110.
> 
> 
> 
> Modifying cmVisualStudio10TargetGenerator.cxx to set the encoding of the
> visual studio file to Windows-1252 instead of utf-8 fixes the problem for
> me.
 
> 
> 
> Clint
> --
> 
> 
> 
> Powered by www.kitware.com
> 
> 
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
 
> 
> 
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
 
> 
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> 
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
 
> 
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
> --
> 
> 
> 
> Powered by www.kitware.com
> 
> 
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
 
> 
> 
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
 
> 
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> 
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
 
> 
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list