sop
sop

Reputation: 3625

How to use the wanted version of OpenCV if there are more?

I have an application that uses OpenCV 2.4.9 and now I want to test OpenCV 3.0.0-beta. I have changed to the tag 3.0.0-beta and build the library. I have installed it and now I have 3 versions of OpenCV installed 2.4.8, 2.4.9 and 3.0.0-beta. Is there a way to choose the version I want?

The application is written in C++ and build using cmake. This is the part of code that makes the linking:

# ...
find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(${EXECUTABLE_NAME}
    # ...
)

target_link_libraries(${EXECUTABLE_NAME} ${OpenCV_LIBS})
# ...

Any help in choosing the version of OpenCV, please?

Upvotes: 4

Views: 8634

Answers (1)

vladisld
vladisld

Reputation: 538

In find_package() command specify the version you need:

find_package(OpenCV 3.0.0 REQUIRED)

for example.

See the CMake doc for find_package for more info.

Upvotes: 7

Related Questions