cmake find_package specify path

前端 未结 1 1699
栀梦
栀梦 2020-12-15 06:11

I have 2 versions of OpenCV installed on my machine. One is in /usr/local/opencv3.1. I presume the install location of the other one (version 3.4) is /usr

相关标签:
1条回答
  • 2020-12-15 06:55

    In the find_package documentation you have that you can set a path to be searched with PATHS you were missing the S... also you can do something like:

    find_package (<package> PATHS paths... NO_DEFAULT_PATH)
    find_package (<package>)
    

    Which will check for the path you wrote first, the if it is found it will set found to true and the second instruction will be skipped.

    Also, you can use the EXACT option to match an specific version, in case it tries to select 3.4 due to being a newer version.

    find_package(OpenCV 3.1 EXACT REQUIRED PATHS /usr/local/opencv3.1)
    

    I hope this helps, if not, write a comment

    0 讨论(0)
提交回复
热议问题