I am currently using CMake to create a bunch of Visual Studio 2013 projects and it works. However, the automatically created ZERO_CHECK and ALL_BUILD projects are set to use MBCS by default although I want them to use the Unicode character set.
I did specify the use of the Unicode character set for my projects with the following :
ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_UNICODE)
and it worked. I tried to set the c++ compiler flags with something like :
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /UMBCS /D_UNICODE /DUNICODE")
or even :
ADD_DEFINITIONS(-DUNICODE)
ADD_DEFINITIONS(-D_UNICODE)
before my project settings, but it did not affect ZERO_CHECK and ALL_BUILD at all. Any Ideas ?
In my case in cmake file CMAKE_MFC_FLAG
was set to non-zero value:
if(NOT WIN_HEAPINSPECTOR)
#static link runtime lib
set(CMAKE_MFC_FLAG 1)
elseif()
#dynamic link runtime lib
set(CMAKE_MFC_FLAG 2)
endif()
I changed it to 0 and then it compiled.
You could use cmake --build . -- /p:CharacterSet=Unicode
to build your project with Unicode set as characterset.
In fact by this way you pass a parameter to do this to MSBuild itself, not CMake.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With