Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC 2017 /Fp and /Yc and /Yu Flags Broken On 391bf6b7609e14f5976bd5247b68d63cbf8d4d12 #173

Open
gblikas opened this issue Jan 11, 2019 · 4 comments

Comments

@gblikas
Copy link

gblikas commented Jan 11, 2019

Running the default example /CMakeLists.txt (top-most CMake Project), via the following command has some interesting command-line settings, which do not seem to actually utilize a pch system. I am running MSVC 2017 (x64).

mkdir build 
cd build
cmake -G "Visual Studio 15 2017 Win64" ../

In particular, here is [example Property Page] -> [C/C++] -> [Command Line] output:

/GS /TP /W3 /Zc:wchar_t /Zi /Gm- /Od /Ob0 /Fd"example.dir\Debug\vc141.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_WINDOWS" /D "CMAKE_INTDIR=\"Debug\"" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /GR /Gd /MDd /FC /Fa"Debug/" /EHsc /nologo /Fo"example.dir\Debug\" /Fp"example.dir\Debug\example.pch" /diagnostics:classic 

For one, /Yu is not used, which causes the core MSVC system not to use a pre-compiled header (afaik, I am not a MSVC wiz). However, it is set in the following 2 methods:

function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersion _prefixFile _pchFile _hostFile _flagsVar)

and

function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerVersion _prefixFile _pchFile _flagsVar)

Another interesting quirk is that /Fp"example.dir\Debug\example.pch doesn't exist:

image

It seems like in either the _unity build, or standard target name build, both should point to the pch content in /build/src/Debug/cotire:

image


If this is already explained in the documentation, I would love to figure out where. I am new to Cotire, so sorry for any obvious mistakes I may have made. Additionally, here is my vswhere.exe output, and CMake version information.

  • cmake version 3.12.1 
    
    CMake suite maintained and supported by Kitware (kitware.com/cmake)
    
  •   "instanceId": "2dae49ae",
      "installDate": "2018-07-12T20:38:51Z",
      "installationName": "VisualStudio/15.9.4+28307.222",
      "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community",
      "installationVersion": "15.9.28307.222",
      "productId": "Microsoft.VisualStudio.Product.Community",
      "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe",
      "isPrerelease": false,
      "displayName": "Visual Studio Community 2017",
      "description": "Free, fully-featured IDE for students, open-source and individual developers",
      "channelId": "VisualStudio.15.Release",
      "channelUri": "https://aka.ms/vs/15/release/channel",
      "enginePath": "C:\\program files (x86)\\microsoft visual studio\\installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
      "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.9.4",
      "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708",
      "updateDate": "2018-12-28T22:26:39.937551Z",
      "catalog": {
        "buildBranch": "d15.9",
        "buildVersion": "15.9.28307.222",
        "id": "VisualStudio/15.9.4+28307.222",
        "localBuild": "build-lab",
        "manifestName": "VisualStudio",
        "manifestType": "installer",
        "productDisplayVersion": "15.9.4",
        "productLine": "Dev15",
        "productLineVersion": "2017",
        "productMilestone": "RTW",
        "productMilestoneIsPreRelease": "False",
        "productName": "Visual Studio",
        "productPatchVersion": "4",
        "productPreReleaseMilestoneSuffix": "1.0",
        "productRelease": "RTW",
        "productSemanticVersion": "15.9.4+28307.222",
        "requiredEngineVersion": "1.18.1042.9589"
      },
      "properties": {
        "campaignId": "369401847.1529645426",
        "channelManifestId": "VisualStudio.15.Release/15.9.4+28307.222",
        "nickname": "2",
        "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe"
      }```
    
    
@gblikas gblikas changed the title MSVC 2017 /Fp and /Yc and /Yu Flags Broken On 391bf6b7609e14f5976bd5247b68d63cbf8d4d12 MSVC 2017 /Fp and /Yc and /Yu Flags Broken On 391bf6b7609e14f5976bd5247b68d63cbf8d4d12 Jan 11, 2019
@gblikas
Copy link
Author

gblikas commented Jan 22, 2019

@sakra Have you gotten a chance to look at this?

@enricodetoma
Copy link

I understand that it might not be a solution for you if you need/want to use Visual Studio IDE, but I'm using VSCode + Visual C++ 2017 + Cotire + Ninja build and /Yu and /Fp flags are all correctly set.

I decided to abandon Visual Studio IDE because it's intellisense was too slow, and I'm quite happy with the current setup, now.

@gblikas
Copy link
Author

gblikas commented Feb 21, 2019

@enricodetoma Have you had a similar experience using a similar setup like I have?

@enricodetoma
Copy link

Sorry no. I wasn't using cotire yet, when I used cmake + visual studio ide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants