Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

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

@gblikas

Description

@gblikas

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"
      }```
    
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions