Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define UNICODE for mingw, if use CMAKE as building system

Good day, i build my Qt project with Cmake build system on windows platform, but if i add line in cmake file:

add_definitions("-DUNICODE -D_UNICODE")
definition of UNICODE not working(MINGW), this work properly only if i build my project with MSVC compiler. After some times i found workaround How do I define a variable when I call CMake, so that qtcreator knows it is defined?, this solution work but if i use native WINAPI functions such as CreateFile i get the compile error, because compiler chose CreateFileA but i use w_char and i would like to use CreateFileW, this is because the definition of macro UNICODE appears before than i include my confugure file.How can i define UNICODE macro in cmakefile?
like image 868
Topilski Alexandr Avatar asked Aug 26 '12 10:08

Topilski Alexandr


1 Answers

Have you tried (note the lack of quotes):

add_definitions(-DUNICODE -D_UNICODE)
like image 176
Jack Kelly Avatar answered Oct 26 '22 11:10

Jack Kelly