find_package allows to specify optional components. This way, the
command will not fail if any of the components marked as optional was
not found. This is useful in cases where components such as xfeatures2d,
viz etc. are not available either because they were not compiled by the
user or package maintainers decided to not provide the packages at all.
The user can check the availability of the optional component using the
OpenCV_<component>_FOUND variable.
- removed OpenCV_LIB_DIR* vars (they are broken and not required anymore)
- OpenCVConfig.cmake doesn't contain ANDROID/CUDA code if there is no such support
- removed OpenCV2_INCLUDE_DIRS_CONFIGCMAKE, merged into OpenCV_INCLUDE_DIRS_CONFIGCMAKE
- fix hard-coded relative paths for OpenCV_INSTALL_PATH
- removed OpenCV_TBB_ARCH
- switch OpenCVConfig.cmake into 2-level mode for Android SDK
syntax of cmake "get_filename_component" changed after version 2.8.11
for cmake version < 2.8.11
get_filename_component(<VAR> <FileName> PATH [CACHE])
for cmake version >= 2.8.11
get_filename_component(<VAR> <FileName> DIRECTORY [CACHE])
Update OpenCVConfig.cmake
Update OpenCVConfig.cmake.in
If I ask for version 2, the current trunk version (version 3), will say it is compatible, which is erroneous.
Do not consider different major versions compatible in cmake config file
With this fix there is no need to add includes by using
`include_directories(${OpenCV_INCLUDE_DIRS})`. Directory will be added by
command `target_link_libraries(... ${OpenCV_LIBS})` automatically.
The use of built-in CMAKE_CURRENT_LIST_DIR requires at least
CMake 2.8.3. This fix properly defines the variable to allow its
use in versions < 2.8.3 as well.
Fixes issue #4205.
Exclude >= 2.8.3 from reimplementation of CMAKE_CURRENT_LIST_DIR
This avoids violation of possible future CMake policy checks
regarding reserved/read-only variables.
This retains the desirable quality of not including paths to CUDA libraries
from the build system into the config files, and has two major advantages:
* It removes the need to use link_directories, which doesn't guarantee that
the libraries from the supplied directory will be used (there may be
libraries with the same names earlier in the search path).
* It removes the need to put -L entries into OPENCV_LINKER_LIBS. This variable
is used with target_link_libraries, where such entries are treated as linker
flags, so doing this is unportable. I remove the support for -L entries
from OpenCVGenPkgconfig.cmake, as well, to discourage adding them in the
future.
The use of built-in CMAKE_CURRENT_LIST_DIR requires at least
CMake 2.8.3. This fix properly defines the variable to allow its
use in versions < 2.8.3 as well.
Fixes issue #4205.
This line causes the following error when building custom projects that use OpenCV beta 3:
ld: warning: directory not found for option '-L/<project_root>/-Wl,/usr/local/cuda'
"TRUE"/"FALSE" should not be used as literals, as CMake has to decide
whether they are literals or variable names (sigh).
This patch should make it work with any version of CMake and with any
user-side decision on old vs. new policy behavior.
I didn't make the status part of the version variables here, because
letters don't play too well with version comparison algorithms
(especially with CMake's, which only supports numbers).
find_package(OpenCV) should not include_directories by default, that is not standard afaik. Plus that creates problems when creating the ROS package :)
* fix path to libraries in Android SDK
* allow to link to opencv_java.so as Android.mk does
To link to opencv_java.so you can either change your cmake to find OpenCV as
find_package(OpenCV opencv_java)
or pass -DOpenCV_FIND_COMPONENTS=opencv_java to your cmake command