I solved the problem and I hope the below notes might help someone.
I'll describe first what I had when the issue was happening. On my device I had python2.7 and python3.6 installed. I wanted to use python3.7. So, I installed it via apt install as follows:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
Since OpenCV needs the python-dev version, I also installed it via apt install python-dev. Unfortunately, that was the problem. This was bound with Python3.6. Because I told cmake to use Python3.7, cmake could not generate the required opencv package since it cannot find the required header files.
When you run cmake, if you see that the "install path" is empty, then you can be sure that you have the same problem I described. Example:
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.7.8)
-- numpy: /usr/local/lib/python3.7/dist-packages/numpy/core/include (ver 1.19.0)
-- install path: -
--
-- Python (for build): /usr/bin/python3
It must show it like this:
-- install path: lib/python3.7/dist-packages/cv2/python-3.7
To solve the problem, uninstall python-dev and install the one specific for python3.7. Example:
sudo apt-get install python3.7-dev
At the end, you should get a single ".so" file. For me, it was placed under:
/usr/local/lib/python3.7/dist-packages/cv2/python-3.7/cv2.cpython-37m-aarch64-linux-gnu.so