Difference between revisions of "Development/Tutorials/D-Bus/Accessing Interfaces/PkgConfigGetVar.cmake"

Jump to: navigation, search
m (Text replace - "</code>" to "</syntaxhighlight>")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<code>include(UsePkgConfig)
+
<syntaxhighlight lang="text">include(UsePkgConfig)
  
 
MACRO(PKGCONFIG_GETVAR _package _var _output_variable)
 
MACRO(PKGCONFIG_GETVAR _package _var _output_variable)
Line 22: Line 22:
 
macro(dbus_add_activation_service _sources)
 
macro(dbus_add_activation_service _sources)
 
     PKGCONFIG_GETVAR(dbus-1 session_bus_services_dir _install_dir)
 
     PKGCONFIG_GETVAR(dbus-1 session_bus_services_dir _install_dir)
     foreach (_i ${ARGN})
+
     foreach (_i ${_sources})
 
         get_filename_component(_service_file ${_i} ABSOLUTE)
 
         get_filename_component(_service_file ${_i} ABSOLUTE)
         string(REGEX REPLACE "\\.service.*$" "\\.service" _output_file ${_i})
+
         string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
 
         set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
 
         set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
         configure_file(${_service_file} ${_output_file})
+
         configure_file(${_service_file} ${_target})
         install(FILES ${_output_file} ${_install_dir}/services)
+
         install(FILES ${_target} DESTINATION ${_install_dir})
 
     endforeach (_i ${ARGN})
 
     endforeach (_i ${ARGN})
endmacro(qdbus_add_activation_service _sources)
+
endmacro(dbus_add_activation_service _sources)
</code>
+
</syntaxhighlight>

Latest revision as of 21:50, 29 June 2011

include(UsePkgConfig)
 
MACRO(PKGCONFIG_GETVAR _package _var _output_variable)
  SET(${_output_variable})
 
  # if pkg-config has been found
  IF(PKGCONFIG_EXECUTABLE)
 
    EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
 
    # and if the package of interest also exists for pkg-config, then get the information
    IF(NOT _return_VALUE)
 
      EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable ${_var} OUTPUT_VARIABLE ${_output_variable} )
 
    ENDIF(NOT _return_VALUE)
 
  ENDIF(PKGCONFIG_EXECUTABLE)
 
ENDMACRO(PKGCONFIG_GETVAR _package _var _output_variable)
 
macro(dbus_add_activation_service _sources)
    PKGCONFIG_GETVAR(dbus-1 session_bus_services_dir _install_dir)
    foreach (_i ${_sources})
        get_filename_component(_service_file ${_i} ABSOLUTE)
        string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
        set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
        configure_file(${_service_file} ${_target})
        install(FILES ${_target} DESTINATION ${_install_dir})
    endforeach (_i ${ARGN})
endmacro(dbus_add_activation_service _sources)

This page was last modified on 29 June 2011, at 21:50. This page has been accessed 3,951 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal