[amarok] cmake/modules: Revert "FindMySQLAmarok.cmake fix argumets when calling mysql_config"

Matěj Laitl matej at laitl.cz
Sun Dec 18 23:38:47 UTC 2011


On 19. 12. 2011 Christophe Giboudeaux wrote:
> On Sunday 18 December 2011 23:27:08 Matej Laitl wrote:
> > Sorry about the incorrect fix, I will build with -Wmissing-include-dirs
> > from now on. However I wonder how to fix the original problem.
> 
> Your commit doesn't mention the issue you're trying to fix. However, having
> the same directory included several times is not an issue (and I'm not aware
> of any GCC flag that would throw a warning).

Ah, I tried to solve http://mail.kde.org/pipermail/amarok-devel/2011-
December/009663.html

Specifically, the problem is that mysql_config (since at least 5.1.56) doesn't 
accept --variable=pkgincludedir - it accepts only --include argument which 
returns something like -I/usr/include/mysql

-- Found MySQL: Usage: /usr/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/include/mysql -DHAVE_ERRNO_AS_DEFINE=1 -
DUNIV_LINUX -DUNIV_LINUX]
        --include        [-I/usr/include/mysql]
        --libs           [-Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib64/mysql 
-lmysqlclient -L/usr//lib64 -lz -lcrypt -lnsl -lm -L/usr/lib64/ -lssl -
lcrypto]
        --libs_r         [-Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib64/mysql 
-lmysqlclient_r -L/usr//lib64 -lz -lpthread -lcrypt -lnsl -lm -lpthread -
L/usr/lib64/ -lssl -lcrypto]
        --plugindir      [/usr/lib64/mysql/plugin]
        --socket         [/var/run/mysqld/mysqld.sock]
        --port           [0]
        --version        [5.1.56]
        --libmysqld-libs [-Wl,-O1 -Wl,--as-needed -rdynamic -L/usr/lib64/mysql 
-lmysqld -ldl -L/usr//lib64 -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt -
L/usr/lib64/ -lssl -lcrypto], -Wl,-O1 -Wl,--as-needed -rdynamic -
L/usr/lib64/mysql -lmysqlclient -L/usr//lib64 -lz -lcrypt -lnsl -lm -
L/usr/lib64/ -lssl -lcrypto

(they you get even longer and *nicer* -Wmissing-include-dirs warnings)

> > Would it be legal to remove MYSQL_INCLUDE_DIR entirely and just rely on
> > MYSQL_CFLAGS to specify -I/path/to/mysql ?
> 
> Well, they don't have the same purpose. MYSQL_CFLAGS is used by the compiler
> (used in 'add_definitions..' lines) while MYSQL_INCLUDE_DIR is used by
> cmake.

...used by cmake (just?) to add -I/path to compiler arguments?

> Also, if mysql_config is not available, MYSQL_CFLAGS is empty and you can
> only count on MYSQL_INCLUDE_DIR.

Ah, I see.

> > E.g. is cmake's include_directories(/dir) just a syntactic sugar for
> > add_definitions(-I/dir) or it would break build on non-gcc platforms?
> > I'd
> > rather avoid filtering "-I" out of MYSQL_INCLUDE_DIR in CMakeLists.
> 
> Without hint about what you're trying to fix, it's hard to answer this
> question.

So I guess we'll have to strip that -I out of `mysql_config --include`. Can we 
safely assume that it is only a single directory?

Regards,
			Matěj


More information about the Amarok-devel mailing list