@@ -66,8 +66,8 @@ target_MyProject_Debug = MyProject
6666 cpp .configurationVariables (cfg )
6767
6868 test .capture [[
69- cflags_MyProject_Debug = /MD
70- cxxflags_MyProject_Debug = /MD /EHsc
69+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE
70+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE
7171ldflags_MyProject_Debug = /NOLOGO
7272objdir_MyProject_Debug = obj/Debug
7373targetdir_MyProject_Debug = bin/Debug
@@ -134,8 +134,8 @@ target_MyProject_Debug = MyProject
134134 cpp .configurationVariables (cfg )
135135
136136 test .capture [[
137- cflags_MyProject_Debug = /MD /DDEBUG /DPLATFORM_WINDOWS
138- cxxflags_MyProject_Debug = /MD /EHsc /DDEBUG /DPLATFORM_WINDOWS
137+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE / DDEBUG /DPLATFORM_WINDOWS
138+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE / DDEBUG /DPLATFORM_WINDOWS
139139ldflags_MyProject_Debug = /NOLOGO
140140objdir_MyProject_Debug = obj/Debug
141141targetdir_MyProject_Debug = bin/Debug
@@ -204,8 +204,8 @@ target_MyProject_Debug = MyProject
204204 cpp .configurationVariables (cfg )
205205
206206 test .capture [[
207- cflags_MyProject_Debug = /MD /Iinclude /Iexternal
208- cxxflags_MyProject_Debug = /MD /EHsc /Iinclude /Iexternal
207+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE / Iinclude /Iexternal
208+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE / Iinclude /Iexternal
209209ldflags_MyProject_Debug = /NOLOGO
210210objdir_MyProject_Debug = obj/Debug
211211targetdir_MyProject_Debug = bin/Debug
@@ -272,8 +272,8 @@ target_MyProject_Debug = MyProject
272272 cpp .configurationVariables (cfg )
273273
274274 test .capture [[
275- cflags_MyProject_Debug = /MD
276- cxxflags_MyProject_Debug = /MD /EHsc
275+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE
276+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE
277277ldflags_MyProject_Debug = /NOLOGO /LIBPATH:"lib" /LIBPATH:"external/lib"
278278objdir_MyProject_Debug = obj/Debug
279279targetdir_MyProject_Debug = bin/Debug
@@ -339,8 +339,8 @@ target_MyProject_Debug = MyProject
339339 cpp .configurationVariables (cfg )
340340
341341 test .capture [[
342- cflags_MyProject_Debug = /MD
343- cxxflags_MyProject_Debug = /MD /EHsc
342+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE
343+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE
344344ldflags_MyProject_Debug = /NOLOGO
345345links_MyProject_Debug = User32.lib Gdi32.lib
346346objdir_MyProject_Debug = obj/Debug
@@ -409,8 +409,8 @@ target_MyProject_Debug = MyProject
409409 cpp .configurationVariables (cfg )
410410
411411 test .capture [[
412- cflags_MyProject_Debug = /MD /W4 /WX
413- cxxflags_MyProject_Debug = /MD /EHsc /W4 /WX
412+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE / W4 /WX
413+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE / W4 /WX
414414ldflags_MyProject_Debug = /NOLOGO
415415objdir_MyProject_Debug = obj/Debug
416416targetdir_MyProject_Debug = bin/Debug
@@ -479,8 +479,8 @@ target_MyProject_Debug = MyProject
479479 cpp .configurationVariables (cfg )
480480
481481 test .capture [[
482- cflags_MyProject_Debug = /MD /UNDEBUG /UOLD_PLATFORM
483- cxxflags_MyProject_Debug = /MD /EHsc /UNDEBUG /UOLD_PLATFORM
482+ cflags_MyProject_Debug = /MD /D_UNICODE /DUNICODE / UNDEBUG /UOLD_PLATFORM
483+ cxxflags_MyProject_Debug = /MD /EHsc /D_UNICODE /DUNICODE / UNDEBUG /UOLD_PLATFORM
484484ldflags_MyProject_Debug = /NOLOGO
485485objdir_MyProject_Debug = obj/Debug
486486targetdir_MyProject_Debug = bin/Debug
@@ -834,3 +834,115 @@ build bin/Debug/MyProject.postbuild: postbuild | bin/Debug/MyProject
834834 postbuildcommands = echo "Finishing build" && cp bin/Debug/MyProject /usr/local/bin/ && chmod +x /usr/local/bin/MyProject
835835 ]]
836836 end
837+
838+
839+ --
840+ -- Check getCxxFlags includes characterset defines for MSC with default character set.
841+ --
842+
843+ function suite .getCxxFlags_withMSCCharactersetDefault ()
844+ toolset " msc"
845+ _OS = " Windows"
846+ files { " main.cpp" }
847+ characterset " Default"
848+
849+ local cfg = prepare ()
850+ local toolset = p .tools .msc
851+ local flags = table.concat (cpp .getCxxFlags (cfg , toolset ), " " )
852+
853+ test .istrue (flags :find (" /D_UNICODE" ) ~= nil )
854+ test .istrue (flags :find (" /DUNICODE" ) ~= nil )
855+ end
856+
857+ --
858+ -- Check getCxxFlags includes characterset defines for MSC with Unicode character set.
859+ --
860+
861+ function suite .getCxxFlags_withMSCCharactersetUnicode ()
862+ toolset " msc"
863+ _OS = " Windows"
864+ files { " main.cpp" }
865+ characterset " Unicode"
866+
867+ local cfg = prepare ()
868+ local toolset = p .tools .msc
869+ local flags = table.concat (cpp .getCxxFlags (cfg , toolset ), " " )
870+
871+ test .istrue (flags :find (" /D_UNICODE" ) ~= nil )
872+ test .istrue (flags :find (" /DUNICODE" ) ~= nil )
873+ end
874+
875+ --
876+ -- Check getCxxFlags includes characterset defines for MSC with MBCS character set.
877+ --
878+
879+ function suite .getCxxFlags_withMSCCharactersetMBCS ()
880+ toolset " msc"
881+ _OS = " Windows"
882+ files { " main.cpp" }
883+ characterset " MBCS"
884+
885+ local cfg = prepare ()
886+ local toolset = p .tools .msc
887+ local flags = table.concat (cpp .getCxxFlags (cfg , toolset ), " " )
888+
889+ test .istrue (flags :find (" /D_MBCS" ) ~= nil )
890+ test .isfalse (flags :find (" /D_UNICODE" ) ~= nil )
891+ test .isfalse (flags :find (" /DUNICODE" ) ~= nil )
892+ end
893+
894+ --
895+ -- Check getCxxFlags excludes characterset defines for MSC with ASCII character set.
896+ --
897+
898+ function suite .getCxxFlags_withMSCCharactersetASCII ()
899+ toolset " msc"
900+ _OS = " Windows"
901+ files { " main.cpp" }
902+ characterset " ASCII"
903+
904+ local cfg = prepare ()
905+ local toolset = p .tools .msc
906+ local flags = table.concat (cpp .getCxxFlags (cfg , toolset ), " " )
907+
908+ test .isfalse (flags :find (" /D_UNICODE" ) ~= nil )
909+ test .isfalse (flags :find (" /DUNICODE" ) ~= nil )
910+ test .isfalse (flags :find (" /D_MBCS" ) ~= nil )
911+ end
912+
913+ --
914+ -- Check getCFlags includes characterset defines for MSC with default character set.
915+ --
916+
917+ function suite .getCFlags_withMSCCharactersetDefault ()
918+ toolset " msc"
919+ _OS = " Windows"
920+ files { " main.c" }
921+ characterset " Default"
922+
923+ local cfg = prepare ()
924+ local toolset = p .tools .msc
925+ local flags = table.concat (cpp .getCFlags (cfg , toolset ), " " )
926+
927+ test .istrue (flags :find (" /D_UNICODE" ) ~= nil )
928+ test .istrue (flags :find (" /DUNICODE" ) ~= nil )
929+ end
930+
931+ --
932+ -- Check getCFlags includes characterset defines for MSC with MBCS character set.
933+ --
934+
935+ function suite .getCFlags_withMSCCharactersetMBCS ()
936+ toolset " msc"
937+ _OS = " Windows"
938+ files { " main.c" }
939+ characterset " MBCS"
940+
941+ local cfg = prepare ()
942+ local toolset = p .tools .msc
943+ local flags = table.concat (cpp .getCFlags (cfg , toolset ), " " )
944+
945+ test .istrue (flags :find (" /D_MBCS" ) ~= nil )
946+ test .isfalse (flags :find (" /D_UNICODE" ) ~= nil )
947+ test .isfalse (flags :find (" /DUNICODE" ) ~= nil )
948+ end
0 commit comments