2014-02-27 12:00:16 +01:00
|
|
|
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# 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
|
2019-05-11 20:29:06 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
|
2014-02-27 12:00:16 +01:00
|
|
|
|
|
|
|
# Add executable plus some additional MySQL specific stuff
|
|
|
|
# Usage (same as for standard CMake's ADD_EXECUTABLE)
|
|
|
|
#
|
|
|
|
# MYSQL_ADD_EXECUTABLE(target source1...sourceN)
|
|
|
|
#
|
|
|
|
# MySQL specifics:
|
|
|
|
# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory
|
|
|
|
# On Windows :
|
|
|
|
# - add version resource
|
|
|
|
# - instruct CPack to do autenticode signing if SIGNCODE is set
|
|
|
|
|
2015-11-20 13:41:22 +01:00
|
|
|
INCLUDE(CMakeParseArguments)
|
2014-02-27 12:00:16 +01:00
|
|
|
|
|
|
|
FUNCTION (MYSQL_ADD_EXECUTABLE)
|
|
|
|
# Pass-through arguments for ADD_EXECUTABLE
|
2015-11-20 13:41:22 +01:00
|
|
|
CMAKE_PARSE_ARGUMENTS(ARG
|
|
|
|
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL"
|
|
|
|
"DESTINATION;COMPONENT"
|
2014-02-27 12:00:16 +01:00
|
|
|
""
|
|
|
|
${ARGN}
|
|
|
|
)
|
2015-11-20 13:41:22 +01:00
|
|
|
LIST(GET ARG_UNPARSED_ARGUMENTS 0 target)
|
|
|
|
LIST(REMOVE_AT ARG_UNPARSED_ARGUMENTS 0)
|
2014-02-27 12:00:16 +01:00
|
|
|
|
2015-11-20 13:41:22 +01:00
|
|
|
SET(sources ${ARG_UNPARSED_ARGUMENTS})
|
2014-02-27 12:00:16 +01:00
|
|
|
ADD_VERSION_INFO(${target} EXECUTABLE sources)
|
2017-03-08 12:12:12 +01:00
|
|
|
|
|
|
|
IF(MSVC)
|
|
|
|
# Add compatibility manifest, to fix GetVersionEx on Windows 8.1 and later
|
|
|
|
IF (CMAKE_VERSION VERSION_GREATER 3.3)
|
|
|
|
SET(sources ${sources} ${PROJECT_SOURCE_DIR}/cmake/win_compatibility.manifest)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2015-11-20 13:41:22 +01:00
|
|
|
IF (ARG_WIN32)
|
|
|
|
SET(WIN32 WIN32)
|
|
|
|
ELSE()
|
|
|
|
UNSET(WIN32)
|
|
|
|
ENDIF()
|
|
|
|
IF (ARG_MACOSX_BUNDLE)
|
|
|
|
SET(MACOSX_BUNDLE MACOSX_BUNDLE)
|
|
|
|
ELSE()
|
|
|
|
UNSET(MACOSX_BUNDLE)
|
|
|
|
ENDIF()
|
|
|
|
IF (ARG_EXCLUDE_FROM_ALL)
|
|
|
|
SET(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
|
|
|
|
ELSE()
|
|
|
|
UNSET(EXCLUDE_FROM_ALL)
|
|
|
|
ENDIF()
|
|
|
|
ADD_EXECUTABLE(${target} ${WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources})
|
2019-05-18 08:11:01 +02:00
|
|
|
|
2014-02-27 12:00:16 +01:00
|
|
|
# tell CPack where to install
|
|
|
|
IF(NOT ARG_EXCLUDE_FROM_ALL)
|
|
|
|
IF(NOT ARG_DESTINATION)
|
|
|
|
SET(ARG_DESTINATION ${INSTALL_BINDIR})
|
2010-02-10 20:23:24 +01:00
|
|
|
ENDIF()
|
|
|
|
IF(ARG_COMPONENT)
|
2019-06-15 18:27:30 +02:00
|
|
|
SET(COMP ${ARG_COMPONENT})
|
2010-02-10 20:23:24 +01:00
|
|
|
ELSEIF(MYSQL_INSTALL_COMPONENT)
|
2019-06-15 18:27:30 +02:00
|
|
|
SET(COMP ${MYSQL_INSTALL_COMPONENT})
|
2010-02-10 20:23:24 +01:00
|
|
|
ELSE()
|
2019-06-15 18:27:30 +02:00
|
|
|
SET(COMP Client)
|
2014-02-27 12:00:16 +01:00
|
|
|
ENDIF()
|
2018-07-13 21:37:22 +02:00
|
|
|
IF (COMP MATCHES ${SKIP_COMPONENTS})
|
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
2020-03-14 17:22:45 +01:00
|
|
|
IF (WITH_STRIPPED_CLIENT AND NOT target STREQUAL mysqld)
|
|
|
|
INSTALL(CODE "SET(CMAKE_INSTALL_DO_STRIP 1)" ${COMP})
|
|
|
|
SET(reset_strip ON)
|
|
|
|
ENDIF()
|
2019-06-15 18:27:30 +02:00
|
|
|
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} COMPONENT ${COMP})
|
2020-03-14 17:22:45 +01:00
|
|
|
IF (reset_strip)
|
|
|
|
INSTALL(CODE "SET(CMAKE_INSTALL_DO_STRIP 0)" ${COMP})
|
|
|
|
ENDIF()
|
2014-02-27 12:00:16 +01:00
|
|
|
ENDIF()
|
2019-05-18 08:11:01 +02:00
|
|
|
|
|
|
|
# create mariadb named symlink
|
|
|
|
CREATE_MARIADB_SYMLINK(${target} ${ARG_DESTINATION} ${COMP})
|
2010-02-10 20:23:24 +01:00
|
|
|
ENDFUNCTION()
|