[CMake] Wrong version of cl.exe for x64

Nils Gladitz nilsgladitz at gmail.com
Mon Aug 22 08:12:24 EDT 2016


On 08/22/2016 01:30 PM, Albrecht Schlosser wrote:

> On 22.08.2016 12:54 Nils Gladitz wrote:
>> On 08/22/2016 12:18 PM, Albrecht Schlosser wrote:
>>
>>> On 22.08.2016 10:33 Nils Gladitz wrote:
>>>
>>>> The visual studio command line environments should have no effect when
>>>> using the visual studio generators.
>>>
>>> Are you sure? Or what does "should" mean here? ;-)
>>
>> Yes. The Visual Studio generators are meant to work outside of the
>> visual studio command line environments while the command line
>> generators (makefiles, ninja) are meant to work from within the visual
>> studio command line environment.
>>
>> What that means is that the Visual Studio generators must work 
>> without it.
>
> Okay, I posted a simple example CMake file to show what happens in my 
> case. See new thread:
>
> "Visual Studio generator does not find some header files"
>
> Basically some special (SDK?) header files are not found when 
> executing CMake w/o the Visual Studio environment.
>

E.g. CMake find_path() uses the INCLUDE environment variable (which is 
provided by the visual studio command line environment) if set.

So yes this can influence CMake itself but not Visual Studio.
Since the paths in the INCLUDE environment variable are not used by 
Visual Studio this can result in obvious conflicts.

Since CMake does not (I don't know if it (easily) could) know the 
implicit include directories Visual Studio uses it can not use them in 
find_*() calls either.

In case of the OpenGL library (which on windows is part of the 
windows/platform SDK) cmake e.g. assumes (within the FindOpenGL.cmake 
module) that the header is in an implicit include directory and does not 
try to locate it.

Assuming this matches your use case I would suggest you do the same.

Nils


More information about the CMake mailing list