summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2009-12-17 14:41:50 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2009-12-17 14:41:50 +0100
commiteb3c44030bf398ddaf033be1a3b1b163faa9bce3 (patch)
treeb9698e003a32f65faf28d6032f377916cf93b648 /cmake
parent07bfd2617db894f9a6a4ad5998941d3517974bb7 (diff)
downloadmariadb-git-eb3c44030bf398ddaf033be1a3b1b163faa9bce3.tar.gz
Replace ADD_EXECUTABLE with MYSQL_ADD_EXECUTABLE for binaries that are installed.
MYSQL_ADD_EXECUTABLE will instructs CPack where to install the exe. On Windows, it also adds version resource and if -DSIGNCODE was given, will sign the exe in packaging step.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/libutils.cmake24
-rw-r--r--cmake/mysql_version.cmake44
-rw-r--r--cmake/plugin.cmake19
-rw-r--r--cmake/versioninfo.rc.in2
4 files changed, 31 insertions, 58 deletions
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 8f2b66f73c3..2d125c8a103 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -205,7 +205,7 @@ ENDMACRO()
# Create libs from libs.
# Merges static libraries, creates shared libraries out of convenience libraries.
-# MYSQL_MERGE_LIBRARIES(target [STATIC|SHARED|MODULE]
+# MERGE_LIBRARIES(target [STATIC|SHARED|MODULE]
# [linklib1 .... linklibN]
# [EXPORTS exported_func1 .... exportedFuncN]
# [OUTPUT_NAME output_name]
@@ -213,7 +213,7 @@ ENDMACRO()
MACRO(MERGE_LIBRARIES)
CMAKE_PARSE_ARGUMENTS(ARG
"EXPORTS;OUTPUT_NAME"
- "STATIC;SHARED;MODULE"
+ "STATIC;SHARED;MODULE;NOINSTALL"
${ARGN}
)
LIST(GET ARG_DEFAULT_ARGS 0 TARGET)
@@ -247,10 +247,11 @@ MACRO(MERGE_LIBRARIES)
ENDIF()
ENDFOREACH()
ENDIF()
-
-
CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}")
- ADD_LIBRARY(${TARGET} SHARED ${SRC})
+ IF(WIN32 AND NOT ARG_NOINSTALL)
+ ADD_VERSION_INFO(${TARGET} VFT_DLL SRC )
+ ENDIF()
+ ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC})
TARGET_LINK_LIBRARIES(${TARGET} ${LIBS})
IF(ARG_OUTPUT_NAME)
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}")
@@ -258,6 +259,9 @@ MACRO(MERGE_LIBRARIES)
ELSE()
MESSAGE(FATAL_ERROR "Unknown library type")
ENDIF()
+ IF(NOT ARG_NOINSTALL)
+ MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION lib)
+ ENDIF()
ENDMACRO()
FUNCTION(GET_DEPENDEND_OS_LIBS target result)
@@ -279,11 +283,11 @@ ENDFUNCTION()
MACRO(RESTRICT_SYMBOL_EXPORTS target)
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
- IF(NOT COMPILE_FLAGS)
- # Avoid COMPILE_FLAGS-NOTFOUND
- SET(COMPILE_FLAGS)
- ENDIF()
+ IF(NOT COMPILE_FLAGS)
+ # Avoid COMPILE_FLAGS-NOTFOUND
+ SET(COMPILE_FLAGS)
+ ENDIF()
SET_TARGET_PROPERTIES(${target} PROPERTIES
- COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
+ COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
ENDIF()
ENDMACRO()
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index b0a77b0bbc9..d8677e6c3ad 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -55,9 +55,10 @@ MACRO(GET_MYSQL_VERSION)
SET(VERSION ${VERSION_STRING})
- STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+[^ ]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
- STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+[^ ]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
- STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)[^ ]+" "\\1" PATCH "${VERSION_STRING}")
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
+
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
@@ -150,39 +151,4 @@ SET(CPACK_SOURCE_IGNORE_FILES
SET(PRODUCTNAME "MySQL Server")
SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
-# Function to embed version info into executables/dlls on Windows
-# Refer http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
-# for more information
-FUNCTION(WIN32_ADD_VERSION_INFO SOURCES)
- IF(NOT WIN32)
- RETURN()
- ENDIF()
- IF(NOT CMAKE_RC_COMPILER)
- RETURN()
- ENDIF()
-
- IF(NOT FILETYPE)
- SET(FILETYPE VFT_APP)
- ENDIF()
-
- IF(NOT MAJOR_VERSION)
- MESSAGE(FATAL_ERROR "MAJOR_VERSION is not defined")
- ENDIF()
- IF(NOT MINOR_VERSION)
- MESSAGE(FATAL_ERROR "MINOR_VERSION is not defined")
- ENDIF()
- IF(NOT PATCH)
- SET(PATCH 0)
- ENDIF()
-
- GET_TARGET_PROPERTY(target_location ${target} LOCATION)
- GET_FILENAME_COMPONENT(INTERNALNAME ${target_location} NAME_WE)
- IF(NOT FILEDESCRIPTION)
- SET(FILEDESCRIPTION ${INTERNALNAME})
- ENDIF()
- GET_FILENAME_COMPONENT(ORIGINALFILENAME ${target_location} NAME)
-
- CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/versioninfo.rc.in
- ${CMAKE_CURRENT_BINARY_DIR}/${target}_versioninfo.rc)
- LIST(APPEND ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${target}_versioninfo.rc)
-ENDFUNCTION()
+
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 41fc3739979..b6a55b2ede0 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -120,7 +120,16 @@ MACRO(MYSQL_ADD_PLUGIN)
FORCE)
ENDIF()
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)
-
+ IF(NOT ARG_MODULE_OUTPUT_NAME)
+ IF(ARG_STORAGE_ENGINE)
+ SET(ARG_MODULE_OUTPUT_NAME "ha_${target}")
+ ELSE()
+ SET(ARG_MODULE_OUTPUT_NAME "${target}")
+ ENDIF()
+ ENDIF()
+ IF(WIN32)
+ ADD_VERSION_INFO(${ARG_MODULE_OUTPUT_NAME} VFT_DLL SOURCES)
+ ENDIF()
ADD_LIBRARY(${target} MODULE ${SOURCES})
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
@@ -142,13 +151,7 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
- IF(NOT ARG_MODULE_OUTPUT_NAME)
- IF(ARG_STORAGE_ENGINE)
- SET(ARG_MODULE_OUTPUT_NAME "ha_${target}")
- ELSE()
- SET(ARG_MODULE_OUTPUT_NAME "${target}")
- ENDIF()
- ENDIF()
+
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
diff --git a/cmake/versioninfo.rc.in b/cmake/versioninfo.rc.in
index 263398836a0..9d581043a2c 100644
--- a/cmake/versioninfo.rc.in
+++ b/cmake/versioninfo.rc.in
@@ -13,7 +13,7 @@ BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "@FILEDESCRIPTION@\0"
- VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@\0"
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
VALUE "InternalName", "@INTERNALNAME@\0"
VALUE "OriginalFilename", "@ORIGINALFILENAME@\0"
END