mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Simplify embedding version info into executables with ADD_VERSION_INFO
This commit is contained in:
@ -37,53 +37,10 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
|
||||
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
|
||||
|
||||
SET(sources ${ARG_DEFAULT_ARGS})
|
||||
IF(WIN32)
|
||||
ADD_VERSION_INFO(${target} VFT_APP sources)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
|
||||
|
||||
# tell CPack where to install
|
||||
IF(NOT ARG_EXCLUDE_FROM_ALL)
|
||||
MYSQL_INSTALL_TARGETS(${target} DESTINATION bin)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
||||
# 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
|
||||
MACRO(ADD_VERSION_INFO target filetype sources)
|
||||
SET(HAVE_RC_FILE)
|
||||
FOREACH(src ${sources})
|
||||
IF("${src}" MATCHES "\\.rc$")
|
||||
SET(HAVE_RC_FILE 1)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
IF(NOT HAVE_RC_FILE)
|
||||
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()
|
||||
SET(FILETYPE ${filetype})
|
||||
SET(INTERNALNAME ${target})
|
||||
IF(FILETYPE STREQUAL VFT_APP)
|
||||
SET(ORIGINALFILENAME ${target}.exe)
|
||||
ELSE()
|
||||
SET(ORIGINALFILENAME ${target}.dll)
|
||||
ENDIF()
|
||||
SET(FILEDESCRIPTION ${target})
|
||||
FIND_FILE(VERINFO_IN versioninfo.rc.in ${CMAKE_MODULE_PATH})
|
||||
IF(NOT VERINFO_IN)
|
||||
MESSAGE(FATAL_ERROR "cannot find version info template")
|
||||
ENDIF()
|
||||
CONFIGURE_FILE(${VERINFO_IN}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${target}.rc)
|
||||
LIST(APPEND ${sources} ${CMAKE_CURRENT_BINARY_DIR}/${target}.rc)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
ENDFUNCTION()
|
Reference in New Issue
Block a user