Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
Submitted: 17 Dec 2010 4:25 Modified: 29 Jan 2011 23:10
Reporter: HOSHNIO Takashi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.8, 5.5.9 OS:Linux (Ubuntu 10.04.1 x86_64)
Assigned to: Tor Didriksen CPU Architecture:Any
Tags: Contribution

[17 Dec 2010 4:25] HOSHNIO Takashi
Description:
cmake option DEFAULT_CHARSET and DEFAULT_COLLATION does not take effects,
latin1 and latin1_swedish_ci will be used.

How to repeat:
run cmake with 
-DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci
and see include/config.h

Suggested fix:
diff -urb mysql-5.5.8.orig/cmake/character_sets.cmake mysql-5.5.8/cmake/character_sets.cma
ke
--- mysql-5.5.8.orig/cmake/character_sets.cmake 2010-12-03 17:58:26.000000000 +0000
+++ mysql-5.5.8/cmake/character_sets.cmake      2010-12-17 04:12:23.000000000 +0000
@@ -18,7 +18,7 @@
 SET(DEFAULT_CHARSET "latin1")
 ENDIF()

-IF(NOT DEFAULT_COLLATIONS)
+IF(NOT DEFAULT_COLLATION)
 SET(DEFAULT_COLLATION "latin1_swedish_ci")
 ENDIF()

diff -urb mysql-5.5.8.orig/config.h.cmake mysql-5.5.8/config.h.cmake
--- mysql-5.5.8.orig/config.h.cmake     2010-12-03 17:58:26.000000000 +0000
+++ mysql-5.5.8/config.h.cmake  2010-12-17 04:12:23.000000000 +0000
@@ -518,8 +518,8 @@
 #cmakedefine CYBOZU 1

 /* Character sets and collations */
-#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "latin1"
-#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
+#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@"
+#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@"

 #cmakedefine USE_MB 1
 #cmakedefine USE_MB_IDENT 1
[17 Dec 2010 8:47] Valeriy Kravchuk
Thank you for the problem report. Verified just as described:

openxs@ubuntu:/home2/openxs/bzr2/mysql-5.5-security$ cmake . -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci
-- MySQL 5.5.9
-- C warning options: -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror
-- C++ warning options: -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wno-unused-parameter
-- Configuring done
-- Generating done
-- Build files have been written to: /home2/openxs/bzr2/mysql-5.5-security
openxs@ubuntu:/home2/openxs/bzr2/mysql-5.5-security$ grep DEFAULT_COLLATION include/config.h 
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
[22 Dec 2010 9:23] 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/127486

3226 Tor Didriksen	2010-12-22
      Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
     @ cmake/character_sets.cmake
        Fix typo in variable name.
        Some cosmetics.
     @ config.h.cmake
        Do not use hard-coded defaults for charset and collation.
[4 Jan 2011 10:24] 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/127870

3213 Tor Didriksen	2011-01-04
      Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
     @ cmake/character_sets.cmake
        Fix typo in variable name.
        Some cosmetics.
     @ config.h.cmake
        Do not use hard-coded defaults for charset and collation.
[6 Jan 2011 10:14] 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/128055

3229 Tor Didriksen	2011-01-06
      Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
     @ cmake/character_sets.cmake
        Fix typo in variable name.
        Some cosmetics.
     @ config.h.cmake
        Do not use hard-coded defaults for charset and collation.
[10 Jan 2011 8:34] 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/128250

3226 Tor Didriksen	2011-01-04
      Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
     @ cmake/character_sets.cmake
        Fix typo in variable name.
        Some cosmetics.
     @ config.h.cmake
        Do not use hard-coded defaults for charset and collation.
[17 Jan 2011 13:03] 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/128963

3259 Tor Didriksen	2011-01-04
      Bug #58991 DEFAULT_CHARSET and DEFAULT_COLLATION does not work with CMake.
     @ cmake/character_sets.cmake
        Fix typo in variable name.
        Some cosmetics.
     @ config.h.cmake
        Do not use hard-coded defaults for charset and collation.
[17 Jan 2011 14:37] 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/128982

3521 Tor Didriksen	2011-01-17 [merge]
      Merge from 5.5: fix for Bug #58991
[17 Jan 2011 14:37] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:tor.didriksen@oracle.com-20110117143652-5uun5ae5edb1vimh) (version source revid:tor.didriksen@oracle.com-20110117143652-5uun5ae5edb1vimh) (merge vers: 5.6.2) (pib:24)
[17 Jan 2011 14:38] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:tor.didriksen@oracle.com-20110104102345-gfgvzspwrndg65he) (version source revid:tor.didriksen@oracle.com-20110104102345-gfgvzspwrndg65he) (merge vers: 5.5.10) (pib:24)
[18 Jan 2011 20:06] Paul DuBois
Noted in 5.5.10, 5.6.2 changelogs.

The DEFAULT_CHARSET and DEFAULT_COLLATION CMake options did not work.
[18 Mar 2011 12:31] Valeriy Kravchuk
Bug #60529 was marked as a duplicate of this one.
[19 Mar 2011 16:48] Georgy Vassilev
In 5.5.10 server part is OK, but for client - problem remains