[icinga-checkins] icinga.org: icinga2/next: Replace FindMYSQL.cmake with another script which has a compatible license

git at icinga.org git at icinga.org
Wed Jun 25 10:22:36 CEST 2014


Module: icinga2
Branch: next
Commit: 726a55fedbb87d4c3a3c2cbcee61d3e052d5ff65
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=726a55fedbb87d4c3a3c2cbcee61d3e052d5ff65

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jun 25 10:21:38 2014 +0200

Replace FindMYSQL.cmake with another script which has a compatible license

fixes #6493

---

 components/db_ido_mysql/CMakeLists.txt |    4 +-
 third-party/cmake/FindMYSQL.cmake      |   47 -------------
 third-party/cmake/FindMySQL.cmake      |  117 ++++++++++++++++++++++++++++++++
 3 files changed, 119 insertions(+), 49 deletions(-)

diff --git a/components/db_ido_mysql/CMakeLists.txt b/components/db_ido_mysql/CMakeLists.txt
index 26687ab..333e144 100644
--- a/components/db_ido_mysql/CMakeLists.txt
+++ b/components/db_ido_mysql/CMakeLists.txt
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software Foundation
 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
-find_package(MYSQL)
+find_package(MySQL)
 
 if(MYSQL_FOUND)
     mkclass_target(idomysqlconnection.ti idomysqlconnection.thpp)
@@ -25,7 +25,7 @@ if(MYSQL_FOUND)
     add_library(db_ido_mysql SHARED idomysqlconnection.cpp idomysqlconnection.thpp db_ido_mysql-type.cpp)
 
     include_directories(${MYSQL_INCLUDE_DIR})
-    target_link_libraries(db_ido_mysql ${Boost_LIBRARIES} ${MYSQL_LIBRARIES} base config icinga db_ido)
+    target_link_libraries(db_ido_mysql ${Boost_LIBRARIES} ${MYSQL_CLIENT_LIBS} base config icinga db_ido)
 
     set_target_properties (
       db_ido_mysql PROPERTIES
diff --git a/third-party/cmake/FindMYSQL.cmake b/third-party/cmake/FindMYSQL.cmake
deleted file mode 100644
index 738f588..0000000
--- a/third-party/cmake/FindMYSQL.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-# - Find mysqlclient
-# Find the native MySQL includes and library
-#
-#  MYSQL_INCLUDE_DIR - where to find mysql.h, etc.
-#  MYSQL_LIBRARIES   - List of libraries when using MySQL.
-#  MYSQL_FOUND       - True if MySQL found.
-
-IF (MYSQL_INCLUDE_DIR)
-  # Already in cache, be silent
-  SET(MYSQL_FIND_QUIETLY TRUE)
-ENDIF (MYSQL_INCLUDE_DIR)
-
-FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
-  /usr/local/include/mysql
-  /usr/include/mysql
-)
-
-SET(MYSQL_NAMES mysqlclient mysqlclient_r)
-FIND_LIBRARY(MYSQL_LIBRARY
-  NAMES ${MYSQL_NAMES}
-  PATHS /usr/lib /usr/local/lib
-  PATH_SUFFIXES mysql
-)
-
-IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-  SET(MYSQL_FOUND TRUE)
-  SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )
-ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-  SET(MYSQL_FOUND FALSE)
-  SET( MYSQL_LIBRARIES )
-ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-
-IF (MYSQL_FOUND)
-  IF (NOT MYSQL_FIND_QUIETLY)
-    MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
-  ENDIF (NOT MYSQL_FIND_QUIETLY)
-ELSE (MYSQL_FOUND)
-  IF (MYSQL_FIND_REQUIRED)
-    MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
-    MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
-  ENDIF (MYSQL_FIND_REQUIRED)
-ENDIF (MYSQL_FOUND)
-
-MARK_AS_ADVANCED(
-  MYSQL_LIBRARY
-  MYSQL_INCLUDE_DIR
-  )
diff --git a/third-party/cmake/FindMySQL.cmake b/third-party/cmake/FindMySQL.cmake
new file mode 100644
index 0000000..b2b666e
--- /dev/null
+++ b/third-party/cmake/FindMySQL.cmake
@@ -0,0 +1,117 @@
+#--------------------------------------------------------
+# Copyright (C) 1995-2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL
+# as it is applied to this software. View the full text of the exception
+# in file LICENSE.exceptions in the top-level directory of this software
+# distribution.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# The MySQL Connector/ODBC is licensed under the terms of the
+# GPL, like most MySQL Connectors. There are special exceptions
+# to the terms and conditions of the GPL as it is applied to
+# this software, see the FLOSS License Exception available on
+# mysql.com.
+
+##########################################################################
+
+
+#-------------- FIND MYSQL_INCLUDE_DIR ------------------
+FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
+  $ENV{MYSQL_INCLUDE_DIR}
+  $ENV{MYSQL_DIR}/include
+  /usr/include/mysql
+  /usr/local/include/mysql
+  /opt/mysql/mysql/include
+  /opt/mysql/mysql/include/mysql
+  /opt/mysql/include
+  /opt/local/include/mysql5
+  /usr/local/mysql/include
+  /usr/local/mysql/include/mysql
+  $ENV{ProgramFiles}/MySQL/*/include
+  $ENV{SystemDrive}/MySQL/*/include)
+
+#----------------- FIND MYSQL_LIB_DIR -------------------
+IF (WIN32)
+  # Set lib path suffixes
+  # dist = for mysql binary distributions
+  # build = for custom built tree
+  IF (CMAKE_BUILD_TYPE STREQUAL Debug)
+    SET(libsuffixDist debug)
+    SET(libsuffixBuild Debug)
+  ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
+    SET(libsuffixDist opt)
+    SET(libsuffixBuild Release)
+    ADD_DEFINITIONS(-DDBUG_OFF)
+  ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
+
+  FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
+    PATHS
+    $ENV{MYSQL_DIR}/lib/${libsuffixDist}
+    $ENV{MYSQL_DIR}/libmysql
+    $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+    $ENV{MYSQL_DIR}/client/${libsuffixBuild}
+    $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+    $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
+    $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
+ELSE (WIN32)
+  FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r
+    PATHS
+    $ENV{MYSQL_DIR}/libmysql_r/.libs
+    $ENV{MYSQL_DIR}/lib
+    $ENV{MYSQL_DIR}/lib/mysql
+    /usr/lib/mysql
+    /usr/local/lib/mysql
+    /usr/local/mysql/lib
+    /usr/local/mysql/lib/mysql
+    /opt/local/mysql5/lib
+    /opt/local/lib/mysql5/mysql
+    /opt/mysql/mysql/lib/mysql
+    /opt/mysql/lib/mysql)
+ENDIF (WIN32)
+
+IF(MYSQL_LIB)
+  GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
+ENDIF(MYSQL_LIB)
+
+IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+  SET(MYSQL_FOUND TRUE)
+
+  INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
+  LINK_DIRECTORIES(${MYSQL_LIB_DIR})
+
+  FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
+  FIND_LIBRARY(MYSQL_YASSL yassl PATHS ${MYSQL_LIB_DIR})
+  FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
+  SET(MYSQL_CLIENT_LIBS mysqlclient_r)
+  IF (MYSQL_ZLIB)
+    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
+  ENDIF (MYSQL_ZLIB)
+  IF (MYSQL_YASSL)
+    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} yassl)
+  ENDIF (MYSQL_YASSL)
+  IF (MYSQL_TAOCRYPT)
+    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
+  ENDIF (MYSQL_TAOCRYPT)
+  # Added needed mysqlclient dependencies on Windows
+  IF (WIN32)
+    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
+  ENDIF (WIN32)
+
+  MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
+  MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
+ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+  MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
+ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)



More information about the icinga-checkins mailing list