Bug #47797 CMake, engine can't specify additional libraries to link with
Submitted: 2 Oct 2009 14:47 Modified: 18 Dec 2009 11:44
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.39 OS:Windows
Assigned to: Magnus Blåudd CPU Architecture:Any

[2 Oct 2009 14:47] Magnus Blåudd
Description:
It's not possible for an engine to specify additional libraries to link with.

How to repeat:
Try to add a storage engine that build a number of own libraries that should be linked with the engine library. 

Suggested fix:
dusky:7.0-win magnus$ bzr diff
=== modified file 'storage/mysql_storage_engine.cmake'
--- storage/mysql_storage_engine.cmake	2009-06-10 08:59:49 +0000
+++ storage/mysql_storage_engine.cmake	2009-10-02 14:30:11 +0000
@@ -7,6 +7,7 @@
 # Remarks:
 # ${engine}_SOURCES  variable containing source files to produce the library must set before
 # calling this macro
+# ${engine}_LIBS variable containing extra libraries to link with may be set
 
 MACRO(MYSQL_STORAGE_ENGINE engine)
 IF(NOT SOURCE_SUBLIBS)
@@ -22,6 +23,9 @@
     #Create static library. The name of the library is <storage_engine>.lib
     ADD_LIBRARY(${libname} ${${engine}_SOURCES})
     ADD_DEPENDENCIES(${libname} GenError)
+    IF(${engine}_LIBS)
+      TARGET_LINK_LIBRARIES(${libname} ${${engine}_LIBS})
+    ENDIF(${engine}_LIBS)
     MESSAGE("build ${engine} as static library")
   ELSEIF(${ENGINE_BUILD_TYPE} STREQUAL "DYNAMIC")
     ADD_DEFINITIONS(-DMYSQL_DYNAMIC_PLUGIN)
@@ -30,6 +34,9 @@
     SET(dyn_libname ha_${libname})
     ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES})
     TARGET_LINK_LIBRARIES (${dyn_libname}  mysqld)
+    IF(${engine}_LIBS)
+      TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS})
+    ENDIF(${engine}_LIBS)
     MESSAGE("build ${engine} as DLL")
   ENDIF(${ENGINE_BUILD_TYPE} STREQUAL "STATIC")
 ENDIF(NOT SOURCE_SUBLIBS)
[2 Oct 2009 19:12] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:frazer@mysql.com-20091002184335-8ue584ev62lh1eoh) (version source revid:frazer@mysql.com-20091002184335-8ue584ev62lh1eoh) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[8 Oct 2009 12:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/86172
[8 Oct 2009 13:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/86174
[8 Oct 2009 13:06] Magnus Blåudd
Pushed to 5.1-bugteam and pe
[14 Oct 2009 14:40] Bugs System
Pushed into 5.1.41 (revid:joro@sun.com-20091014143611-cphb0enjlx6lpat1) (version source revid:satya.bn@sun.com-20091013071829-zc4c3go44j6re592) (merge vers: 5.1.40) (pib:13)
[15 Oct 2009 7:26] MC Brown
A note has been added to the 5.1.41 and 5.1.39-ndb-7.1.0 changelogs: 

When building storage engines on Windows it was not possible to specify additional libraries within the CMake file required for the build. An ${engine}_LIBS macro has been added to the files to support these additional storage-engine specific libraries.
[22 Oct 2009 6:35] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091022063126-l0qzirh9xyhp0bpc) (version source revid:alik@sun.com-20091019135554-s1pvptt6i750lfhv) (merge vers: 6.0.14-alpha) (pib:13)
[22 Oct 2009 7:07] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091022060553-znkmxm0g0gm6ckvw) (version source revid:alik@sun.com-20091019131708-bc6pv55x6287a0wc) (merge vers: 5.5.0-beta) (pib:13)
[30 Oct 2009 11:17] MC Brown
A note has been added to the 5.5.0 and 6.0.14 changelog: 

When building storage engines on Windows it was not possible to specify additional
libraries within the CMake file required for the build. An ${engine}_LIBS macro has been
added to the files to support these additional storage-engine specific libraries.
[18 Dec 2009 10:32] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:48] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 10:50] MC Brown
Added entry to 5.1.41-ndb-7.1.0
[18 Dec 2009 11:03] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:17] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 11:44] MC Brown
Already documented in 5.1.41