[Commits] 7931ca4: MDEV-9024 Build fails with VS2015

wlad at mariadb.com wlad at mariadb.com
Tue Nov 3 14:05:00 EET 2015


revision-id: 7931ca4f89ad5cd38ea3dc54f1363b7de2fd3414 (mariadb-10.0.22-5-g7931ca4)
parent(s): fa1438cbf4307731a54ea4137d5f7d4b744cdfbc
committer: Vladislav Vaintroub
timestamp: 2015-11-03 11:32:00 +0100
message:

MDEV-9024 Build fails with VS2015

Fix build failures caused by new C runtime library
- isnan, snprintf, struct timespec are now defined, attempt to redefine them leads
- P_tmpdir, tzname are no more defined
-  lfind() and lsearch() in lf_hash.c had to be renamed,  declaration
conflicts with some C runtime functions with the same name declared
in a header included by stdlib.h

 Also fix couple of annoying warnings :
- remove #define NOMINMAX from config.h to avoid "redefined" compiler
warnings(NOMINMAX is already in compile flags)

- disable incremental linker in Debug as well (feature not used much
and compiler crashes often)


Also simplify package building with Wix, require Wix 3.9 or later
(VS2015 is not compatible with old Wix 3.5/3.6)

---
 client/mysql.cc                 |  2 +-
 client/mysqltest.cc             |  2 +-
 cmake/os/Windows.cmake          |  8 +++---
 cmake/os/WindowsCache.cmake     |  4 ---
 config.h.cmake                  | 11 ++++----
 configure.cmake                 |  2 ++
 include/hash.h                  |  4 +--
 include/my_pthread.h            |  2 ++
 libmysql/errmsg.c               |  2 +-
 mysys/hash.c                    |  2 +-
 mysys/lf_hash.c                 | 40 +++++++++++++--------------
 win/packaging/CMakeLists.txt    | 60 +++++++++++++++++++++++++++++------------
 win/packaging/ca/CMakeLists.txt | 42 +----------------------------
 13 files changed, 85 insertions(+), 96 deletions(-)

diff --git a/client/mysql.cc b/client/mysql.cc
index 60bed6b..71eac78 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1108,7 +1108,7 @@ inline int get_command_index(char cmd_char)
     All client-specific commands are in the first part of commands array
     and have a function to implement it.
   */
-  for (uint i= 0; *commands[i].func; i++)
+  for (uint i= 0; commands[i].func; i++)
     if (commands[i].cmd_char == cmd_char)
       return i;
   return -1;
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index e28d56e..c601fb5 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5246,7 +5246,7 @@ static st_error global_error_names[] =
 #include <my_base.h>
 static st_error handler_error_names[] =
 {
-  { "<No error>", -1U, "" },
+  { "<No error>", UINT_MAX, "" },
 #include <handler_ername.h>
   { 0, 0, 0 }
 };
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 4c01bab..fd6e739 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -96,8 +96,11 @@ IF(MSVC)
    STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
    STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
    STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
+   STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
+   STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_DEBUG "${CMAKE_${type}_LINKER_FLAGS_DEBUG}")
    SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release")
   ENDFOREACH()
+
   
   # Mark 32 bit executables large address aware so they can 
   # use > 2GB address space
@@ -113,7 +116,7 @@ IF(MSVC)
   
   #TODO: update the code and remove the disabled warnings
   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099")
 
   IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
     # _WIN64 is defined by the compiler itself. 
@@ -181,14 +184,13 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
 CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
 CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
 CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
-CHECK_SYMBOL_REPLACEMENT(isnan _isnan float.h)
 CHECK_SYMBOL_REPLACEMENT(finite _finite float.h)
 CHECK_FUNCTION_REPLACEMENT(popen _popen)
 CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
 CHECK_FUNCTION_REPLACEMENT(access _access)
 CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp)
 CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp)
-CHECK_FUNCTION_REPLACEMENT(snprintf _snprintf)
+CHECK_SYMBOL_REPLACEMENT(snprintf _snprintf stdio.h)
 CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s)
 CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64)
 CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64)
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index b805ec4..2808a6f 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -101,7 +101,6 @@ SET(HAVE_IPPROTO_IPV6 CACHE  INTERNAL "")
 SET(HAVE_IPV6 TRUE CACHE  INTERNAL "")
 SET(HAVE_IPV6_V6ONLY 1 CACHE  INTERNAL "")
 SET(HAVE_ISINF CACHE  INTERNAL "")
-SET(HAVE_ISNAN CACHE  INTERNAL "")
 SET(HAVE_ISSETUGID CACHE  INTERNAL "")
 SET(HAVE_GETUID CACHE  INTERNAL "")
 SET(HAVE_GETEUID CACHE  INTERNAL "")
@@ -231,7 +230,6 @@ SET(HAVE_SIZEOF_ULONG FALSE CACHE  INTERNAL "")
 SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE  INTERNAL "")
 SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE  INTERNAL "")
 SET(HAVE_SLEEP CACHE  INTERNAL "")
-SET(HAVE_SNPRINTF CACHE  INTERNAL "")
 SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE  INTERNAL "")
 SET(HAVE_SOLARIS_STYLE_GETHOST CACHE  INTERNAL "")
 SET(STACK_DIRECTION -1 CACHE INTERNAL "")
@@ -324,10 +322,8 @@ SET(WORDS_BIGENDIAN CACHE  INTERNAL "")
 SET(HAVE__S_IFIFO 1 CACHE  INTERNAL "")
 SET(HAVE__S_IREAD 1 CACHE  INTERNAL "")
 SET(HAVE__finite 1 CACHE  INTERNAL "")
-SET(HAVE__isnan 1 CACHE  INTERNAL "")
 SET(HAVE__pclose 1 CACHE  INTERNAL "")
 SET(HAVE__popen 1 CACHE  INTERNAL "")
-SET(HAVE__snprintf 1 CACHE  INTERNAL "")
 SET(HAVE__stricmp 1 CACHE  INTERNAL "")
 SET(HAVE__strnicmp 1 CACHE  INTERNAL "")
 SET(HAVE__strtoi64 1 CACHE  INTERNAL "")
diff --git a/config.h.cmake b/config.h.cmake
index 46eed79..a1d505f 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -317,6 +317,8 @@
 #cmakedefine HAVE_TIMESPEC_TS_SEC 1
 #cmakedefine STRUCT_DIRENT_HAS_D_INO 1
 #cmakedefine STRUCT_DIRENT_HAS_D_NAMLEN 1
+#cmakedefine STRUCT_TIMESPEC_HAS_TV_SEC 1
+#cmakedefine STRUCT_TIMESPEC_HAS_TV_NSEC 1
 #cmakedefine SPRINTF_RETURNS_INT 1
 
 #define USE_MB 1
@@ -514,17 +516,16 @@
 #cmakedefine strtoll @strtoll@
 #cmakedefine strtoull @strtoull@
 #cmakedefine vsnprintf @vsnprintf@
+#if (_MSC_VER > 1800)
+#define tzname _tzname
+#define P_tmpdir "C:\\TEMP"
+#endif
 #if (_MSC_VER > 1310)
 # define HAVE_SETENV
 #define setenv(a,b,c) _putenv_s(a,b)
 #endif
 #define PSAPI_VERSION 1     /* for GetProcessMemoryInfo() */
 
-/* We don't want the min/max macros */
-#ifdef __WIN__
-#define NOMINMAX
-#endif
-
 /*
   MySQL features
 */
diff --git a/configure.cmake b/configure.cmake
index fb12768..f8c58da 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1056,3 +1056,5 @@ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h"  STRUCT_DIRENT_HAS_D_IN
 CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h"  STRUCT_DIRENT_HAS_D_NAMLEN)
 SET(SPRINTF_RETURNS_INT 1)
 CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
+CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV_SEC)
+CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC)
diff --git a/include/hash.h b/include/hash.h
index ba36df2..fde7fc3 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -44,7 +44,7 @@ extern "C" {
 
 typedef uint my_hash_value_type;
 typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
-typedef my_hash_value_type (*my_hash_function)(const CHARSET_INFO *,
+typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
                                                const uchar *, size_t);
 typedef void (*my_hash_free_key)(void *);
 typedef my_bool (*my_hash_walk_action)(void *,void *);
@@ -78,7 +78,7 @@ uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
 uchar *my_hash_search_using_hash_value(const HASH *info,
                                        my_hash_value_type hash_value,
                                        const uchar *key, size_t length);
-my_hash_value_type my_hash_sort(const CHARSET_INFO *cs,
+my_hash_value_type my_hash_sort(CHARSET_INFO *cs,
                                 const uchar *key, size_t length);
 #define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C)
 uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
diff --git a/include/my_pthread.h b/include/my_pthread.h
index bb4d0c8..cff6416 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -86,10 +86,12 @@ typedef volatile LONG my_pthread_once_t;
 #define MY_PTHREAD_ONCE_INPROGRESS 1
 #define MY_PTHREAD_ONCE_DONE 2
 
+#if !STRUCT_TIMESPEC_HAS_TV_SEC  || !STRUCT_TIMESPEC_HAS_TV_NSEC
 struct timespec {
   time_t tv_sec;
   long tv_nsec;
 };
+#endif
 
 int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
 int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index 84884f9..e30cdc9 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -90,7 +90,7 @@ const char *client_errors[]=
   ""
 };
 
-const char** get_client_errmsgs()
+const char** get_client_errmsgs(void)
 {
   return client_errors;
 }
diff --git a/mysys/hash.c b/mysys/hash.c
index 4ef731c..344b698 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -40,7 +40,7 @@ static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
 static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
                    size_t length);
 
-my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, const uchar *key,
+my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
                                 size_t length)
 {
   ulong nr1= 1, nr2= 4;
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index aa96ca9..fa92971 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -43,7 +43,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
 
 /*
   a structure to pass the context (pointers two the three successive elements
-  in a list) from lfind to linsert/ldelete
+  in a list) from my_lfind to my_linsert/my_ldelete
 */
 typedef struct {
   intptr volatile *prev;
@@ -70,7 +70,7 @@ typedef struct {
     cursor is positioned in either case
     pins[0..2] are used, they are NOT removed on return
 */
-static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
+static int my_lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
                  const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins)
 {
   uint32       cur_hashnr;
@@ -138,7 +138,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
 /*
   DESCRIPTION
     insert a 'node' in the list that starts from 'head' in the correct
-    position (as found by lfind)
+    position (as found by my_lfind)
 
   RETURN
     0     - inserted
@@ -148,7 +148,7 @@ static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
     it uses pins[0..2], on return all pins are removed.
     if there're nodes with the same key value, a new node is added before them.
 */
-static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
+static LF_SLIST *my_linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
                          LF_SLIST *node, LF_PINS *pins, uint flags)
 {
   CURSOR         cursor;
@@ -156,7 +156,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
 
   for (;;)
   {
-    if (lfind(head, cs, node->hashnr, node->key, node->keylen,
+    if (my_lfind(head, cs, node->hashnr, node->key, node->keylen,
               &cursor, pins) &&
         (flags & LF_HASH_UNIQUE))
     {
@@ -200,7 +200,7 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
   NOTE
     it uses pins[0..2], on return all pins are removed.
 */
-static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
+static int my_ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
                    const uchar *key, uint keylen, LF_PINS *pins)
 {
   CURSOR cursor;
@@ -208,7 +208,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
 
   for (;;)
   {
-    if (!lfind(head, cs, hashnr, key, keylen, &cursor, pins))
+    if (!my_lfind(head, cs, hashnr, key, keylen, &cursor, pins))
     {
       res= 1; /* not found */
       break;
@@ -232,7 +232,7 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
             (to ensure the number of "set DELETED flag" actions
             is equal to the number of "remove from the list" actions)
           */
-          lfind(head, cs, hashnr, key, keylen, &cursor, pins);
+          my_lfind(head, cs, hashnr, key, keylen, &cursor, pins);
         }
         res= 0;
         break;
@@ -258,12 +258,12 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
     it uses pins[0..2], on return the pin[2] keeps the node found
     all other pins are removed.
 */
-static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
+static LF_SLIST *my_lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
                          uint32 hashnr, const uchar *key, uint keylen,
                          LF_PINS *pins)
 {
   CURSOR cursor;
-  int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins);
+  int res= my_lfind(head, cs, hashnr, key, keylen, &cursor, pins);
   if (res)
     _lf_pin(pins, 2, cursor.curr);
   else
@@ -363,7 +363,7 @@ void lf_hash_destroy(LF_HASH *hash)
    -1 - out of memory
 
   NOTE
-    see linsert() for pin usage notes
+    see my_linsert() for pin usage notes
 */
 int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
 {
@@ -384,7 +384,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
   if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
     return -1;
   node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */
-  if (linsert(el, hash->charset, node, pins, hash->flags))
+  if (my_linsert(el, hash->charset, node, pins, hash->flags))
   {
     _lf_alloc_free(pins, node);
     lf_rwunlock_by_pins(pins);
@@ -407,7 +407,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
     1 - didn't (not found)
    -1 - out of memory
   NOTE
-    see ldelete() for pin usage notes
+    see my_ldelete() for pin usage notes
 */
 int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
 {
@@ -427,7 +427,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
   */
   if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
     return -1;
-  if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1,
+  if (my_ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1,
               (uchar *)key, keylen, pins))
   {
     lf_rwunlock_by_pins(pins);
@@ -446,7 +446,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
     MY_ERRPTR    if OOM
 
   NOTE
-    see lsearch() for pin usage notes
+    see my_lsearch() for pin usage notes
 */
 void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
 {
@@ -460,7 +460,7 @@ void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
     return MY_ERRPTR;
   if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins)))
     return MY_ERRPTR;
-  found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1,
+  found= my_lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1,
                  (uchar *)key, keylen, pins);
   lf_rwunlock_by_pins(pins);
   return found ? found+1 : 0;
@@ -488,16 +488,16 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
   dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
   dummy->key= dummy_key;
   dummy->keylen= 0;
-  if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
+  if ((cur= my_linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
   {
     my_free(dummy);
     dummy= cur;
   }
   my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
   /*
-    note that if the CAS above failed (after linsert() succeeded),
-    it would mean that some other thread has executed linsert() for
-    the same dummy node, its linsert() failed, it picked up our
+    note that if the CAS above failed (after my_linsert() succeeded),
+    it would mean that some other thread has executed my_linsert() for
+    the same dummy node, its my_linsert() failed, it picked up our
     dummy node (in "dummy= cur") and executed the same CAS as above.
     Which means that even if CAS above failed we don't need to retry,
     and we should not free(dummy) - there's no memory leak here
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt
index 3b9b72f..0535a48 100644
--- a/win/packaging/CMakeLists.txt
+++ b/win/packaging/CMakeLists.txt
@@ -17,36 +17,62 @@ IF(NOT WIN32)
   RETURN()
 ENDIF()
 
+IF(MSVC_VERSION LESS 1600)
+ RETURN()
+ENDIF()
+
+
+
 SET(MANUFACTURER "MariaDB Corporation Ab")
 FIND_PATH(WIX_DIR heat.exe
-   $ENV{WIX_DIR}/bin
-   $ENV{ProgramFiles}/wix/bin
-  "$ENV{ProgramFiles}/Windows Installer XML v3/bin"
-  "$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
-  "$ENV{ProgramFiles}/Windows Installer XML v3.6/bin"
   "$ENV{ProgramFiles}/WiX Toolset v3.9/bin"
-  "$ENV{WIX}/bin"
+  "$ENV{ProgramFiles}/WiX Toolset v3.10/bin"
 )
-
 SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB")
 IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
  SET(CPACK_WIX_UPGRADE_CODE "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3")
- SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION at .@MINOR_VERSION@")
+ SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION}")
 ELSE()
  SET(CPACK_WIX_UPGRADE_CODE "2331E7BD-EE58-431B-9E18-B2B918BCEB1B")
- SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION at .@MINOR_VERSION@ (x64)")
+ SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION} (x64)")
 ENDIF()
 
+IF(WIX_DIR)
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(WIX_ARCH_SUFFIX "x64")
+ELSE()
+  SET(WIX_ARCH_SUFFIX "x86")
+ENDIF()
+# Need some Wix SDK libraries to link with customaction
+IF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
+  SET(WIX_MSVC_SUFFIX "VS2010")
+ELSEIF(MSVC_VERSION EQUAL 1800)
+  SET(WIX_MSVC_SUFFIX "VS2013")
+ELSEIF (MSVC_VERSION EQUAL 1900)
+  SET(WIX_MSVC_SUFFIX "VS2015")
+ENDIF()
+
+
+FIND_LIBRARY(WIX_WCAUTIL_LIBRARY 
+  NAMES wcautil${WIX_ARCH_SUFFIX}  wcautil${WIX_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
+  wcautil
+  PATHS 
+  ${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX}
+  )
+
+FIND_LIBRARY(WIX_DUTIL_LIBRARY 
+  NAMES dutil${WIX_ARCH_SUFFIX} 
+  dutil
+  PATHS 
+  ${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX}
+  )
+ENDIF()
 
-IF(NOT WIX_DIR)
-  IF(NOT _WIX_DIR_CHECKED)
-    SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
-    MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
-    IF(BUILD_RELEASE)
+IF(NOT WIX_DUTIL_LIBRARY)
+  MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
+  IF(BUILD_RELEASE)
       MESSAGE(FATAL_ERROR
-        "Can't find Wix. It is necessary for producing official package"
-      )
-    ENDIF()
+        "Can't find Wix. It is necessary for producing official package")
   ENDIF()
   RETURN()
 ENDIF()
diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt
index ccd0313..c57ae4b 100644
--- a/win/packaging/ca/CMakeLists.txt
+++ b/win/packaging/ca/CMakeLists.txt
@@ -13,53 +13,13 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc)
-LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
-
+INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/inc)
 SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
 
-IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  SET(WIX_ARCH_SUFFIX "_x64")
-  SET(WIX36_ARCH_SUFFIX "x64")
-ELSE()
-  SET(WIX_ARCH_SUFFIX)
-  SET(WIX36_ARCH_SUFFIX "x86")
-ENDIF()
-
-IF(MSVC_VERSION EQUAL 1400)
-  SET(WIX35_MSVC_SUFFIX "_2005")
-ELSEIF(MSVC_VERSION EQUAL 1500)
-  SET(WIX35_MSVC_SUFFIX "_2008")
-  SET(WIX36_MSVC_SUFFIX "VS2008")
-ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
-  SET(WIX35_MSVC_SUFFIX "_2010")
-  SET(WIX36_MSVC_SUFFIX "VS2010")
-ELSEIF(MSVC_VERSION EQUAL 1800  OR MSVC_VERSION EQUAL 1900 )
-  SET(WIX35_MSVC_SUFFIX "_2013")
-  SET(WIX36_MSVC_SUFFIX "VS2013")
-ELSE()
-  # When next VS is out, add the correct version here
-  MESSAGE(FATAL_ERROR "Unknown VS version")
-ENDIF()
-INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/inc)
 
-FIND_LIBRARY(WIX_WCAUTIL_LIBRARY 
-  NAMES wcautil${WIX_ARCH_SUFFIX}  wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
-  wcautil
-  PATHS 
-  ${WIX_DIR}/../SDK/lib 
-  ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX}
-  )
 
-FIND_LIBRARY(WIX_DUTIL_LIBRARY 
-  NAMES dutil${WIX_ARCH_SUFFIX}  dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
-  dutil
-  PATHS 
-  ${WIX_DIR}/../SDK/lib
-  ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX}
-  )
 
 ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES)
 ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES})


More information about the commits mailing list