From da04322b4c429de9a6f5aa06545c10284ec2e56d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Apr 2016 17:25:37 -0700 Subject: Make moc obey the preprocessor environment variable for include paths C preprocessors augment their standard list of include paths from the environment: Unix preprocessors use $C_INCLUDE_PATH (for C) and $CPLUS_INCLUDE_PATH (for C++), plus CPATH for both, whereas MSVC uses the an environment variable simply called "INCLUDE". Handling this for MSVC is particularly important because the VCVARSALL.BAT script sets the necessary #include paths in the environment for important things. Without that being parsed, moc won't find some #defines, like WINAPI_DESKTOP_FAMILY. [ChangeLog][moc] qmake and moc now cooperate to use the Visual Studio environment variables (set by the VCVARSALL.BAT script) to find system include files. A possible consequence is that moc parses application headers slightly differently, depending on #if conditions that depended on macros that previous versions had not seen #define'd. Implementers of other buildsystems are advised to pass the --compiler-flavor=msvc option to moc. Change-Id: I7e06274214d1939b0124e5b4bf169cceaef9ca46 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/Qt5CoreMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib/Qt5CoreMacros.cmake') diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 9235641544..23909c9f3f 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -90,6 +90,9 @@ macro(QT5_GET_MOC_FLAGS _moc_flags) if(WIN32) set(${_moc_flags} ${${_moc_flags}} -DWIN32) endif() + if (MSVC) + set(${_moc_flags} --compiler-flavor=msvc) + endif() endmacro() -- cgit v1.2.3