Cmake error with Python_LIBRARY not set

This is the note to myself.

While I compile the framework with cmake, I got error of not found environment variable “Python_LIBRARY”, so I google myself to find the solution.

Original command:

cmake .. && cmake --build .

Issue

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PYTHON_LIBRARY
    linked by target "ann_manh" in directory /home/tphan/lmgc90_user_2021.rc1/src/contribs/ann-1.1.2/wrap
    linked by target "ann_eucl" in directory /home/tphan/lmgc90_user_2021.rc1/src/contribs/ann-1.1.2/wrap
    linked by target "lmgc90" in directory /home/tphan/lmgc90_user_2021.rc1/src/ChiPy

The solution

mkdir build && cd build && cmake .. -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPython_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so && cmake --build .

Comment Disabled for this post!