Skip to content

Commit

Permalink
Made cmake check which version of python is currently in the user's path
Browse files Browse the repository at this point in the history
and try to link against that one rather than whatever might be installed
system wide.
  • Loading branch information
davisking committed May 30, 2015
1 parent 2cab4c5 commit d5170a3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dlib/add_python_module
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()


# Sometimes a computer will have multiple python verions installed. So in this
# block of code we find the one in the user's path and add its home folder into
# cmake's search path. That way it will use that version of python first.
find_program(PYTHON_EXECUTABLE python)
# Resolve symbolic links, hopefully this will give us a path in the proper
# python home directory.
get_filename_component(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} REALPATH)
# Pick out the parent directories
get_filename_component(PYTHON_PATH ${PYTHON_EXECUTABLE} PATH)
get_filename_component(PYTHON_PATH ${PYTHON_PATH} PATH)
set(CMAKE_PREFIX_PATH ${PYTHON_PATH})



#SET(Boost_USE_STATIC_LIBS OFF)
#SET(Boost_USE_MULTITHREADED ON)
#SET(Boost_USE_STATIC_RUNTIME OFF)
Expand Down

0 comments on commit d5170a3

Please sign in to comment.