diff options
author | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-11-12 13:42:50 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-11-12 13:42:50 +0100 |
commit | 36fffdeaa22c7208d3744613a7bd7bbe6e49b394 (patch) | |
tree | 2a9de33eb5ae75bb7de7ffa7ac486e42126b9bca /cmake | |
parent | 5a8b8b6493b11a07973f5ee16885a9d8b9cbb456 (diff) | |
download | mariadb-git-36fffdeaa22c7208d3744613a7bd7bbe6e49b394.tar.gz |
Bug#58074: ADD_VERSION_INFO cmake/mysql_version.cmake fails if LINK_FLAGS are modified
Backport version info handling (Windows-specific) from next-mr.
Instead of adding ".res" object as linker flag, add resource file (.rc) file to the source list.
This is more obvious and less error prone method.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/install_macros.cmake | 2 | ||||
-rw-r--r-- | cmake/libutils.cmake | 3 | ||||
-rw-r--r-- | cmake/mysql_add_executable.cmake | 2 | ||||
-rw-r--r-- | cmake/mysql_version.cmake | 34 | ||||
-rw-r--r-- | cmake/plugin.cmake | 1 |
5 files changed, 13 insertions, 29 deletions
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index bc8d9945690..ddfbcd09ce4 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -224,8 +224,6 @@ FUNCTION(MYSQL_INSTALL_TARGETS) IF(SIGNCODE AND SIGNCODE_ENABLED) SIGN_TARGET(${target}) ENDIF() - # For Windows, add version info to executables - ADD_VERSION_INFO(${target}) # Install man pages on Unix IF(UNIX) GET_TARGET_PROPERTY(target_location ${target} LOCATION) diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 0cc8895f43e..89eb5a74d80 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -250,6 +250,9 @@ MACRO(MERGE_LIBRARIES) ENDFOREACH() ENDIF() CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}") + IF(NOT ARG_NOINSTALL) + ADD_VERSION_INFO(${TARGET} SHARED SRC) + ENDIF() ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC}) TARGET_LINK_LIBRARIES(${TARGET} ${LIBS}) IF(ARG_OUTPUT_NAME) diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index b49a737716c..ac812fbcdfd 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -37,7 +37,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
SET(sources ${ARG_DEFAULT_ARGS})
-
+ ADD_VERSION_INFO(${target} EXECUTABLE sources)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 886d7b9e8a9..9f0f7729c22 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -133,9 +133,8 @@ ENDIF() # Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx # for more info. IF(MSVC) - GET_TARGET_PROPERTY(location gen_versioninfo LOCATION) - IF(NOT location) GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + SET(FILETYPE VFT_APP) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) @@ -143,31 +142,14 @@ IF(MSVC) SET(FILETYPE VFT_DLL) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) - - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_BINARY_DIR}/versioninfo_exe.res - ${CMAKE_BINARY_DIR}/versioninfo_dll.res - COMMAND ${CMAKE_RC_COMPILER} versioninfo_exe.rc - COMMAND ${CMAKE_RC_COMPILER} versioninfo_dll.rc - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - ADD_CUSTOM_TARGET(gen_versioninfo - DEPENDS - ${CMAKE_BINARY_DIR}/versioninfo_exe.res - ${CMAKE_BINARY_DIR}/versioninfo_dll.res - ) - ENDIF() - - FUNCTION(ADD_VERSION_INFO target) - GET_TARGET_PROPERTY(target_type ${target} TYPE) - ADD_DEPENDENCIES(${target} gen_versioninfo) - IF(target_type MATCHES "SHARED" OR target_type MATCHES "MODULE") - SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS - "\"${CMAKE_BINARY_DIR}/versioninfo_dll.res\"") - ELSEIF(target_type MATCHES "EXE") - SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS - "${target_link_flags} \"${CMAKE_BINARY_DIR}/versioninfo_exe.res\"") + + FUNCTION(ADD_VERSION_INFO target target_type sources_var) + IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE") + SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) + ELSEIF("${target_type}" MATCHES "EXE") + SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) ENDIF() + SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE) ENDFUNCTION() ELSE() FUNCTION(ADD_VERSION_INFO) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 94fdc8bf1e9..bf34407db25 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -151,6 +151,7 @@ MACRO(MYSQL_ADD_PLUGIN) ENDIF() ENDIF() + ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) DTRACE_INSTRUMENT(${target}) SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" |