I found an inconsistency when executing CMake directly from a desktop link vs. running it for instance from a "Developer Command Prompt for VS2015" _or_ executing CMake's (re)configure stage from within the Visual Studio environment after modifying one of the CMake files.

This seems to indicate that "something" is not set up correctly if I execute CMake directly (clicking the desktop link or running it from the Windows Explorer).

On 22.08.2016 12:54 Nils Gladitz wrote in another thread:

> 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.

The following example CMakeLists.txt file seems to indicate that this is not true, at least for CMake 3.2.1. I'm currently not keen on installing another (newer) CMake version, but if this is fixed in a newer version I can do this.

System: Windows 10
Visual Studio 2015 Community 2015, Update 3
CMake 3.2.1

Here is my minimal CMakeLists.txt that is needed to run the configure step and show the results. Note that "other" header files are found w/o issues.

I can provide more (with a configure_file) if requested.

#-------------------------------------
# CMakeLists.txt
#-------------------------------------
cmake_minimum_required(VERSION 2.8)

project (find_headers)

find_file (HAVE_GL_GL_H GL/gl.h)
find_file (HAVE_GL_GLU_H GL/glu.h)
find_file (HAVE_LOCALE_H locale.h)

if (MSVC)
  message(STATUS "Note: The following three headers should all be found!")
  message(STATUS "HAVE_GL_GL_H = '${HAVE_GL_GL_H}'")
  message(STATUS "HAVE_GL_GLU_H = '${HAVE_GL_GLU_H}'")
  message(STATUS "HAVE_LOCALE_H = '${HAVE_LOCALE_H}'")
message(STATUS "If one of these headers was not found, run cmake-gui ...") message(STATUS "... again from a Visual Studio developer command prompt!")
endif (MSVC)
#-------------------------------------
# End of CMakeLists.txt
#-------------------------------------

# Run cmake-gui directly by clicking the installed desktop link
# to the cmake-gui executable
# Click 'configure'

The C compiler identification is MSVC 19.0.24213.1
The CXX compiler identification is MSVC 19.0.24213.1
Check for working C compiler using: Visual Studio 14 2015 Win64
Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 14 2015 Win64
Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Note: The following three headers should all be found!
HAVE_GL_GL_H = 'HAVE_GL_GL_H-NOTFOUND'
HAVE_GL_GLU_H = 'HAVE_GL_GLU_H-NOTFOUND'
HAVE_LOCALE_H = 'HAVE_LOCALE_H-NOTFOUND'
If one of these headers was not found, run cmake-gui ...
... again from a Visual Studio developer command prompt!
Configuring done

# Repeating configure ...

Note: The following three headers should all be found!
HAVE_GL_GL_H = 'HAVE_GL_GL_H-NOTFOUND'
HAVE_GL_GLU_H = 'HAVE_GL_GLU_H-NOTFOUND'
HAVE_LOCALE_H = 'HAVE_LOCALE_H-NOTFOUND'
If one of these headers was not found, run cmake-gui ...
... again from a Visual Studio developer command prompt!
Configuring done

# Now executing "Developer Command Prompt for VS2015"

C:\Program Files (x86)\Microsoft Visual Studio 14.0>c:\CMake\bin\cmake.exe --version
cmake version 3.2.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\Program Files (x86)\Microsoft Visual Studio 14.0>c:\CMake\bin\cmake-gui.exe

# Clicking 'configure' in the same build directory configured before:

Note: The following three headers should all be found!
HAVE_GL_GL_H = 'C:/Program Files (x86)/Windows Kits/8.1/Include/um/GL/gl.h'
HAVE_GL_GLU_H = 'C:/Program Files (x86)/Windows Kits/8.1/Include/um/GL/glu.h' HAVE_LOCALE_H = 'C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt/locale.h'
If one of these headers was not found, run cmake-gui ...
... again from a Visual Studio developer command prompt!
Configuring done

# End of log

As you can see, CMake finds the above mentioned headers when
executed from a "Developer Command Prompt for VS2015", but not
when executed directly by clicking the CMake desktop link or
clicking cmake-gui in the windows explorer.

Further tests show that CMake also finds the headers when it needs to reconfigure something within the VS IDE because a CMake file was changed.

Wild guess: given the paths of the header files in question I assume that it has something to do with the SDK files ('Windows Kits/8.1/Include/um/GL/...' and 'Windows Kits/10/Include/10.0.10240.0/ucrt/...'
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to