How let cmake know that dependencies must firstly be from a certain location

How can we force cmake to check that dependencies must firstly be looked up in a certain directory instead of default /usr/bin/, /usr/lib/, etc Linux dirs., then that default, in that order

as its cmake firstly check the Linux default shared lib.:

Could NOT find OpenImageIO: Found unsuitable version "2.0.5", but required
  is at least "2.1.12"

but those required libs. and their deps have been being prepared and gathered in one certain directory only, how to to do such that it will build olive smoothly

I’m a newbie on Cmake, could know few commands now, so would one point out the gist of the key commands along with their brief yet very clear explanations that’d give to the solution?
also what’s the difference of CMakeLists.txt and .cmake files
Please help out

“How can we force cmake to check that dependencies must firstly be looked up in a certain directory instead of default /usr/bin/, /usr/lib/, etc Linux dirs., then that default, in that order”

find_package has documentation on the search procedure

"The default search order is designed to be most-specific to least-specific for common use cases. "

Let’s look at the first thing find_package uses to search:

From the cmake docs:

  1. New in version 3.12: Search paths specified in the <PackageName>_ROOT CMake variable and the <PackageName>_ROOT environment variable, where <PackageName> is the package to be found. The package root variables are maintained as a stack so if called from within a find module, root paths from the parent’s find module will also be searched after paths for the current package. This can be skipped if NO_PACKAGE_ROOT_PATH is passed or by setting the CMAKE_FIND_USE_PACKAGE_ROOT_PATH to FALSE. See policy CMP0074.

Basically can either do a more global approach or a more narrow approach

# So basically I think you want the more global approach
# “How can we force cmake to check that dependencies must firstly be looked up in a certain directory instead of default /usr/bin/, /usr/lib/, etc Linux dirs., then that default, in that order”
# Let's say 'certain directory' is called foobar
set(foobar "C:/foobar")
list(APPEND CMAKE_FIND_ROOT_PATH "${foobar}")

# Now it will look at "C:/foobar" first.
find_package(OpenImageIO 2.1.12 REQUIRED)

I think that answers your primary question.

You are overloading your question. So I’ll just suggest you checkout this book.

1 Like

Also it’s more helpful to users in the future that you just paste the code that is causing you problems instead of linking to the GitHub.

Something like this would suffice:

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

project(olive-editor VERSION 0.2.0 LANGUAGES CXX)

...

find_package(OpenGL REQUIRED)

find_package(OpenColorIO 2.0.0 REQUIRED)

find_package(OpenImageIO 2.1.12 REQUIRED)

find_package(OpenEXR REQUIRED)

find_package(Qt5 5.6 REQUIRED
  COMPONENTS
  Core
  Gui
  Widgets
  Multimedia
  OpenGL
  Svg
  LinguistTools
  Concurrent
)

find_package(FFMPEG 3.0 REQUIRED
  COMPONENTS
  avutil
  avcodec
  avformat
  avfilter
  swscale
  swresample
)

find_package(OpenTimelineIO)

Also I just checked out your project very cool :smiley:

Was I able to answer your question @abd ?