MantisBT - CMake
View Issue Details
0013818CMakeModulespublic2012-12-28 15:042016-06-10 14:31
Reid Kleckner 
Kitware Robot 
normalminoralways
closedmoved 
CygwinWindows7
CMake 2.8.10.2 
 
0013818: FindPythonInterp finds a cygwin symlink which can't be used with execute_process
I'm using native Windows CMake from a Cygwin shell, so Cygwin Python is on my PATH. My /usr/bin looks like:
$ ll /usr/bin/python*
lrwxrwxrwx 1 rnk Domain Users 13 Aug 20 18:35 /usr/bin/python -> python2.6.exe
-rwxr-xr-x 1 rnk Domain Users 4622 Jun 9 2012 /usr/bin/python2.6.exe
-rwxr-xr-x 1 rnk Domain Users 1419 Jun 9 2012 /usr/bin/python2.6-config
lrwxrwxrwx 1 rnk Domain Users 16 Aug 20 18:35 /usr/bin/python-config -> python2.6-config

FindPythonInterp.cmake uses find_program() with "python" first, which succeeds.

This is a reasonable result to return, but then execute_process fails on the Cygwin symlink file. It doesn't seem reasonable for native Windows CMake to know how to follow Cygwin symlinks, so maybe find_program should fail on such symlinks, or FindPythonInterp should test that it can actually execute the python executable, and fall back to its version based queries.

As a workaround, it's pretty easy for me to point it at the right executable.
Install or build native Windows CMake
In a Cygwin shell, run cmake on this script:

include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
  message(FATAL_ERROR "can't find python")
endif ()

execute_process(
  COMMAND ${PYTHON_EXECUTABLE} -c "print \"hello\"" RESULT_VARIABLE result)
if (NOT "${result}" STREQUAL "0")
  message(FATAL_ERROR "PYTHON_EXECUTABLE failed, is it a symlink?")
endif ()
No tags attached.
Issue History
2012-12-28 15:04Reid KlecknerNew Issue
2016-06-10 14:28Kitware RobotNote Added: 0042186
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042186)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.