FindPython resolves the symbolic links when using virtual environment
When you are using a Python virtual environment, FindPython is resolving the symbolic link to the real Python executable. If your build system is running Python scripts and these scripts need third-party packages, Python will fail. Python will fail because it will not be able to find the Python packages installed in the virtualenv.
How to reproduce:
Run:
python3 -m venv deps
source deps/bin/activate
In your CMakeLists.txt, place:
find_package(Python3 COMPONENTS Interpreter REQUIRED)
Run CMake:
Output:
-- The C compiler identification is GNU 8.1.1
-- The CXX compiler identification is GNU 8.1.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found Python3: /usr/bin/python3.6 (found version "3.6.6") found components: Interpreter