python

What to do when CMake can't find your Python files

I've been using Vim for some time, and I really like YouCompleteMe, an autocompletion programming engine. Unfortunately, while the author is always working towards making installation quick and painless, there is always something that breaks in the process. For me, a consistent issue I've had is CMake being able to detect my Python installation. I still can't figure out why CMake has so much trouble detecting it, but until it is fixed, here's a quick solution if you find yourself in the same situation.

For reference, I am running Windows 10 64 bit, and all the software packages (CMake, Vim, Python, LLVM) I am using are x64 builds.

Ususally, what I run into is this:

CMake can't find the Python libraries and include directories

To fix it, simply add:

-DPYTHON_LIBRARY="C:\Program Files\Python35\libs\python35.lib"
-DPYTHON_INCLUDE_DIR="C:\Program Files\Python35\include"

As command line arguments (the path to your python35.lib and include directory might be different, especially if you use the 32 bit version on a 64 bit machine).

I'm hoping this is eventually fixed or improved, because it's not very user friendly.

References:
https://cmake.org/cmake/help/v3.7/module/FindPythonLibs.html?highlight=findpython#module:FindPythonLibs