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”
"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:
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
Global: You can set CMAKE_FIND_ROOT_PATH so that all find_* calls looks there first.
Or set the root path for each individual package: PackageName_ROOT
# 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.