Ticket #1203 (new defect)
Do not add "AND NOT PKG_CONFIG_FOUND" in cmake modules
|Reported by:||scriptor||Owned by:||bricks|
|Component:||OpenSync: Build Environment||Version:||0.39|
|Severity:||minor||Keywords:||cmake modules and pkg-config in cross-compiling scenarios|
many cmake modules are written in this way:
(pkg-config looks for the library...) (...) # Look for libxml-2.0 include dir and libraries w/o pkgconfig IF ( NOT LIBXML2_FOUND AND NOT PKG_CONFIG_FOUND ) (...) (cmake itself searches for the library...) ENDIF ( NOT LIBXML2_FOUND AND NOT PKG_CONFIG_FOUND )
So the pkg-config independent code can only be reached on systems without pkg-config.
But this code should also be executed on systems with pkg-config, if LIBXML2 could NOT be found. It should ALWAYS be executed, when the library in question can not be found. Regardless of whether or not pkg-config is installed.
Otherwise you get into trouble in some cross-compiling scenarios.
pkg-config does not work well in certain cross-compiling situations. Whereas cmake itself works much better in these cases, because cmake can be told about the library mapping when you compile for a different target.
So the build system must be able to search for the library in question without using pkg-config, even when pkg-config is installed.
I try and add two patches for those two cmake modules which have caused me some trouble. And to clarify what I mean...
- Severity changed from normal to minor
- Milestone set to OpenSync 0.40