I have a question about the CMake command find_package.
For example, when I want use OpenCV, I can set the variable OpenCV_DIR. OpenCV_DIR also has a default value. But which command generates this variable OpenCV_DIR, and when?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Behind the scenes, the find_package command is running a CMake file. This file is executed as your CMake file is being run, when they are called by your CMake file. These files (ex, FindOpenCV.cmake) set the variables in question.
When I am having issues with a find_package command, I often gain some clarity by reading through the corresponding FindWhateverPackage.cmake file.