Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • find_package(OpenCV 3.1 EXACT REQUIRED PATHS /usr/local/opencv3.1) works in my case. Thank you. Commented Apr 13, 2018 at 12:09
  • 1
    I just tested this, and still didn't work, until I commented the second line (i.e., only worked when there was JUST the option with the specified path) Commented Feb 22, 2019 at 0:43
  • @Bersan The documentation says to use it multiple times... Normally I only use the first one but without NO_DEFAULT_PATH when I need one library in a specific path and usually it works good.... However I used it for libraries that are not installed in my system but just compiled.... Commented Feb 22, 2019 at 8:33
  • 3
    it works for me, if I set set(SDL2_DIR /usr/local/lib/cmake/SDL2) before find_package(SDL2 REQUIRED) Commented Mar 29, 2020 at 19:05
  • Also works for OpenCV 4.4 which is installed in /usr/local/ (default installed from source) My command: find_package(OpenCV 4.4 EXACT REQUIRED PATHS /usr/local/) Thanks!!! Commented Apr 11, 2022 at 2:03