Commit a8e5e5c5 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Add cmake macros add_executable_version_info and add_library_version_info



This helps to reduce duplicated code.
Signed-off-by: Ralf Habacker's avatarRalf Habacker <ralf.habacker@freenet.de>
parent b641eddd
......@@ -90,11 +90,7 @@ include_directories(
)
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-daemon")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND BUS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(BUS_SOURCES "dbus-daemon")
endif()
add_library(dbus-daemon-internal STATIC ${BUS_SOURCES})
......@@ -127,11 +123,7 @@ if (DBUS_SERVICE)
# ${BUS_SOURCES}
)
set(DBUS_VER_INTERNAL_NAME "dbus-service")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_service_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_service_SOURCES "dbus-service")
add_executable(dbus-service ${dbus_service_SOURCES} )
target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
......
......@@ -182,3 +182,21 @@ macro(add_uac_manifest _sources)
endif()
list(APPEND ${_sources} ${outfile})
endmacro()
macro(add_executable_version_info _sources _name)
set(DBUS_VER_INTERNAL_NAME "${_name}")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(${CMAKE_SOURCE_DIR}/dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
# version info and uac manifest can be combined in a binary because they use different resource types
list(APPEND ${_sources} ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endmacro()
macro(add_library_version_info _sources _name)
set(DBUS_VER_INTERNAL_NAME "${_name}")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_DLL")
configure_file(${CMAKE_SOURCE_DIR}/dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
# version info and uac manifest can be combined in a binary because they use different resource types
list(APPEND ${_sources} ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
endmacro()
......@@ -236,11 +236,7 @@ if(DEFINED DBUS_LIBRARY_REVISION)
endif()
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "${CMAKE_SHARED_LIBRARY_PREFIX}dbus-1-${DBUS_LIBRARY_MAJOR}")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_DLL")
configure_file(versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
list(APPEND libdbus_SOURCES versioninfo.rc)
add_library_version_info(libdbus_SOURCES "${CMAKE_SHARED_LIBRARY_PREFIX}dbus-1-${DBUS_LIBRARY_MAJOR}")
endif()
if(MSVC_IDE)
......
......@@ -59,11 +59,7 @@ set (dbus_run_session_SOURCES
)
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-send")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_send_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_send_SOURCES "dbus-send")
endif()
add_executable(dbus-send ${dbus_send_SOURCES})
......@@ -71,11 +67,7 @@ target_link_libraries(dbus-send ${DBUS_LIBRARIES})
install(TARGETS dbus-send ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-test-tool")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_test_tool_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_test_tool_SOURCES "dbus-test-tool")
endif()
add_executable(dbus-test-tool ${dbus_test_tool_SOURCES})
......@@ -83,12 +75,7 @@ target_link_libraries(dbus-test-tool ${DBUS_LIBRARIES})
install(TARGETS dbus-test-tool ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
# version info and uac manifest can be combined in a binary because they use different resource types
set(DBUS_VER_INTERNAL_NAME "dbus-update-activation-environment")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_update_activation_environment_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_update_activation_environment_SOURCES "dbus-update-activation-environment")
endif()
if(WIN32 AND NOT MSVC)
add_uac_manifest(dbus_update_activation_environment_SOURCES)
......@@ -98,11 +85,7 @@ target_link_libraries(dbus-update-activation-environment ${DBUS_LIBRARIES})
install(TARGETS dbus-update-activation-environment ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-launch")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_launch_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_launch_SOURCES "dbus-launch")
endif()
add_executable(dbus-launch ${dbus_launch_SOURCES})
......@@ -113,11 +96,7 @@ endif (DBUS_BUILD_X11)
install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})
if(WIN32)
set(DBUS_VER_INTERNAL_NAME "dbus-monitor")
set(DBUS_VER_ORIGINAL_NAME "${DBUS_VER_INTERNAL_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(DBUS_VER_FILE_TYPE "VFT_APP")
configure_file(../dbus/versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
list(APPEND dbus_monitor_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc)
add_executable_version_info(dbus_launch_SOURCES "dbus-monitor")
endif()
add_executable(dbus-monitor ${dbus_monitor_SOURCES})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment