See also

It might be very difficult to exactly pin the Python interpreter and its development components to be of the exact same version. This is especially true for those cases where they are installed in non-standard locations or there is more than one version of each installed on your system. New Python detection modules have been added to CMake in its version 3.12 that are aimed at solving this vexing problem. The detection portion of our CMakeLists.txt would also be greatly simplified to:

find_package(Python COMPONENTS Interpreter Development REQUIRED)

We encourage you to read the documentation for the new module at: https://cmake.org/cmake/help/v3.12/module/FindPython.html

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.