On Monday 19 December 2011 00:38:47 =?utf-8?B?TWF0xJtq?= Laitl wrote:
> 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]
[cut]

> 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?
> 

ok, then it only exists in higher version (the option exists in 5.5.x). 

I see two solutions: 
- only rely on find_path(MYSQL_INCLUDE_DIR...), so move it outside the 
else(MYSQLCONFIG_EXECUTABLE) loop  [1]

- Drop FindMysqlAmarok.cmake and use FindAmarok.cmake from kdelibs instead 
(which worked fine here).

I prefer the second solution as the FindMysql from kdelibs is really cleaner 
than the Amarok copy:

- MYSQL_CFLAGS doesn't look that important

- the linked targets gathered with 'mysql_config --libs' are already 
explicitly added in the CMakeLists.txt files (./src/core-
impl/collections/db/sql/mysqlecollection/CMakeLists.txt, ./src/core-
impl/collections/db/sql/mysqlservercollection/CMakeLists.txt and some unit 
tests) and the output variable is different if mysql_config is not present:

  * with mysql_config, MYSQL_LIBRARIES="-L/usr/lib64 -lmysqlclient -lpthread -
lz -lm -lrt -lssl -lcrypto -ldl"
  * without it, MYSQL_LIBRARIES=/usr/lib64/libmysqlclient.so. The second one 
is enough

- the kdelibs FindAmarok has better chances to detect mysql.h under Windows,
- and it also uses a cleaner way to decide if mysqle is there.


The first solution is the easy one, the second one needs more testing on 
different platforms/distributions.

Christophe

[1] attached: fixMySQLAmarok.diff
diff --git a/cmake/modules/FindMySQLAmarok.cmake b/cmake/modules/FindMySQLAmarok.cmake
index 74805ca..44a3fb5 100644
--- a/cmake/modules/FindMySQLAmarok.cmake
+++ b/cmake/modules/FindMySQLAmarok.cmake
@@ -16,8 +16,18 @@ if(NOT WIN32)
     find_program(MYSQLCONFIG_EXECUTABLE NAMES mysql_config mysql_config5 PATHS ${BIN_INSTALL_DIR} ~/usr/bin /usr/local/bin)
 endif(NOT WIN32)
 
+find_path(MYSQL_INCLUDE_DIR mysql.h
+    /opt/local/include/mysql5/mysql
+    /opt/mysql/mysql/include
+    /opt/mysqle/include/mysql
+    /opt/ports/include/mysql5/mysql
+    /usr/include/mysql
+    /usr/local/include/mysql
+    /usr/mysql/include/mysql
+    ~/usr/include/mysql
+)
+
 if(MYSQLCONFIG_EXECUTABLE)
-    exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --variable=pkgincludedir RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_INCLUDE_DIR)
     exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_CFLAGS)
     exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_LIBRARIES)
     exec_program(${MYSQLCONFIG_EXECUTABLE} ARGS --libmysqld-libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_EMBEDDED_LIBSTEMP)
@@ -49,18 +59,6 @@ if(MYSQLCONFIG_EXECUTABLE)
 
 else(MYSQLCONFIG_EXECUTABLE)
 
-    find_path(MYSQL_INCLUDE_DIR mysql.h
-       ~/usr/include/mysql
-       /opt/local/include/mysql5/mysql
-       /opt/mysqle/include/mysql
-       /opt/mysql/mysql/include 
-       /usr/mysql/include/mysql
-       /usr/include/mysql
-       /usr/local/include/mysql
-       /opt/local/include/mysql
-       /opt/ports/include/mysql5/mysql
-    )
-
     if(WIN32)
         set(MYSQL_CLIENT_LIBRARY_NAME libmysql)
     else(WIN32)

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Amarok-devel mailing list
Amarok-devel@kde.org
https://mail.kde.org/mailman/listinfo/amarok-devel

Reply via email to