Commit Graph

21 Commits

Author SHA1 Message Date
Biswapriyo Nath
7e5d012f75 cmake: Enable pkgconfig support for mingw 2022-08-21 12:06:46 +05:30
Alexander Alekhin
a956732874 cmake: update install paths (Linux) 2018-09-19 15:43:52 +03:00
Maksim Shabunin
b1fe298764 Removed cmake submodules and contrib_world references 2017-10-19 17:34:59 +03:00
Alexander Alekhin
87a98e4562 cmake: CMP0026 NEW 2017-08-19 15:15:05 +00:00
Alexander Alekhin
f0c14888d5 fixes #5018: fix framework links in opencv.pc (MacOS) 2015-12-14 15:14:23 +03:00
Maksim Shabunin
3863dc5b2b Updated pkg-config generation, added sample makefile 2015-05-22 16:09:07 +03:00
Samuel Martin
671a630f47 cmake/OpenCVGenPkgconfig.cmake: rework opencv.pc generation
Using absolute path to locate the components in the "Libs:" field of the
*.pc can badly break cross-compilation, especially when building
statically linked objects.

Indeed, pkg-config automatically replaces the '-I...' and '-L...' paths
when the PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR environment
variables are set [1]. This feature is very helpful and common in
cross-compilation framework like Buildroot [2,3].

When there are absolute paths in the *.pc files, pkg-config won't be
able to do the path substitutions for these paths when the
aforementioned environment variables are set.
In such case, since the prefix is the target one, not the sysroot one,
these libraries' absolute paths will point to:
- in the best case: a non-existing file (i.e. these files do not exists
  on the host system;
- at worst: the host system's libraries. This will make the linking
  failed because these host system's libraries will most likely not be
  build for the target architecture [4].

So, this patch replace the components' absolute paths by the form:
  -L<libdir> -l<libname>

This way, the linker will be able to resolve each dependency path,
whatever the kind of objects/build (shared object or static build) it
is dealing with.

Note that for static link, the library order does matter [5]. The order
of the opencv components has been carefully chosen to comply with this
requirement.

Fixes #3931

This patch is a port of [6] on the master branch.

[1] http://linux.die.net/man/1/pkg-config
[2] http://buildroot.org/
[3] http://git.buildroot.net/buildroot/tree/package/pkgconf/pkg-config.in
[4] http://autobuild.buildroot.net/results/e8a/e8a859276db34aff87ef181b0cce98916b0afc90/build-end.log
[5] http://stackoverflow.com/questions/45135/linker-order-gcc
[6] eceada586b

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2015-05-22 16:09:05 +03:00
Maksim Shabunin
a5a510da4b Support for compound modules, support for contrib_world 2015-02-10 18:30:05 +03:00
Roman Donchenko
0dad2876e2 Removed all use of the obsolete IMMEDIATE parameter to configure_file.
It's not documented, and it does nothing unless CMake 2.0 compatibility
is enabled (and it isn't):

https://github.com/Kitware/CMake/blob/v2.6.0/Source/cmConfigureFileCommand.cxx
2014-01-29 19:34:02 +04:00
Alexander Smorkalov
b75cbfde45 All installed files marked with component names for install customization. 2014-01-21 20:34:36 +04:00
Roman Donchenko
428fb72625 Made the generated file templates' naming more consistent.
The general convention is <output file name> + ".in".
2013-11-14 19:14:38 +04:00
Greg Hale
387587f4f0 regex doesnt need to match full length of input, so only trying to match the leading -[lL] 2013-10-21 09:27:04 -04:00
Greg Hale
fe3dd762a4 fixed wrong regex 2013-10-19 17:30:32 -04:00
Greg Hale
0c4d484679 added backslash 2013-10-17 14:17:49 -04:00
Greg Hale
61ccd170bd shortened code to not repeat myself 2013-10-17 14:12:02 -04:00
Greg Hale
5bd5993663 Only append -l to lib entries with no path and no -l or -L of their own 2013-10-17 14:05:06 -04:00
Greg Hale
70df365c87 changed foreach variable to match naming conventions and dropped intermediate variable, appending directly to the LIB_COMPONENTS list 2013-10-15 14:54:58 -04:00
Greg Hale
f23b51de6f Added -l prefix to EXTRA_COMPONENTS when generating pkg-config file 2013-10-14 13:36:07 -04:00
Roman Donchenko
78cb920bc8 Removed useless VERSION macro (and CMake variable) 2013-07-11 14:30:46 +04:00
Marina Kolpakova
b28b2428f6 changing package layout after 'make install' for Android build 2012-06-28 17:23:50 +00:00
Andrey Kamaev
984eb99428 Global CMake reorganization:
[~] Automatically tracked dependencies between modules
 [+] Support for optional module dependencies
 [+] Options to choose modules to build
 [~] Removed hardcoded modules lists from OpenCVConfig.cmake, opencv.pc and OpenCV.mk
 [+] Added COMPONENTS support for FIND_PACKAGE(OpenCV)
 [~] haartraining and traincascade are moved outside of modules folder since they aren't the modules
2012-02-03 11:26:49 +00:00