Showing posts with label Learning cmake. Show all posts
Showing posts with label Learning cmake. Show all posts

Tuesday, 12 July 2011

:: error: No rule to make target `/home/puneet/puneet/office/alkimia/alkquotes/backend/org.kde.quotebackend.keyusermanager.xml', needed by `backend/keyusermanageradaptor.cpp'. Stop.

I am getting this error a lot of times


That's usually because you don't have a file called keusermanager.cpp available to make. Check that:
  • that file exists.
  • you're in the right directory when you make.
Actuall I didnt knew that we have to make this file ourselves , So I searched a bit and found it that indeed we have to make this ourselves but can be done in a faster way with almost no errors using qdbuscpp2xml switches

qdbuscpp2xml

To generate the XML we will be using the qdbuscpp2xml command line tool that comes with Qt. This program takes a C++ source file and generates a D-Bus XML definition of the interface for us. It lets us to define which methods to export using the following command line switches:
qdbuscpp2xml switches
Switch Exports
-S all signals
-M all public slots
-P all properties
-A all exportable items
-s scriptable signals
-m scriptable public slots
-p scriptable properties
-a all scriptable items
In our example above we want to export all the public slots but only scriptable signals. Therefore we would use this command line:
$> qdbuscpp2xml -M -s background.h -o org.foo.Background.xml
This produces a file named org.foo.Background.xml which contains this:
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
  <interface name="org.foo.Background">
    <signal name="backgroundChanged">
    </signal>
    <method name="refreshBackground">
    </method>
    <method name="currentBackground">
      <arg type="s" direction="out"/>
    </method>
    <method name="setBackground">
      <arg type="b" direction="out"/>
      <arg name="name" type="s" direction="in"/>
    </method>
  </interface>
</node>
This file should be shipped with your project's source distribution.

    Meaning of marking a package REQUIRED

    while coding the CMakeLists.txt we often see some packages marked as REQUIRED
    FIND_PACKAGE( QT4 REQUIRED)
    It means the build will stop if the QT4 is not present.
    refer to the page for further information http://summer-opensource.blogspot.com/2011/07/learning-cmake.html

    Learning CMAKE

    All CMake projects are described in a file called CMakeLists.txt, which corresponds to the project file that QMake uses. Each CMake file is based around a project, so the file starts by setting the project’s name to basics using the PROJECT command.

    ADD DEFENITIONS

    add_definitions( ${QT_DEFINITIONS} ${KDE4DEFINITIONS} )

    #  QT_DEFINITIONS - definitions to use when
    #                   compiling code that uses Qt.
    
    

    add library

    Add a library to the project using the specified source files.
    add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL]
                  source1 source2 ... sourceN)
    Adds a library target called <name> to be built from the source files listed in the command invocation. The <name> corresponds to the logical target name and must be globally unique within a project. The actual file name of the library built is constructed based on conventions of the native platform (such as lib<name>.a or <name>.lib).
    STATIC, SHARED, or MODULE may be given to specify the type of library to be created. STATIC libraries are archives of object files for use when linking other targets. SHARED libraries are linked dynamically and loaded at runtime. MODULE libraries are plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality. If no type is given explicitly the type is STATIC or SHARED based on whether the current value of the variable BUILD_SHARED_LIBS is true.
    By default the library file will be created in the build tree directory corresponding to the source tree directory in which the command was invoked. See documentation of the ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY, and RUNTIME_OUTPUT_DIRECTORY target properties to change this location. See documentation of the OUTPUT_NAME target property to change the <name> part of the final file name.
    If EXCLUDE_FROM_ALL is given the corresponding property will be set on the created target. See documentation of the EXCLUDE_FROM_ALL target property for details.
    The add_library command can also create IMPORTED library targets using this signature:
    add_library(<name> <SHARED|STATIC|MODULE|UNKNOWN> IMPORTED)
    An IMPORTED library target references a library file located outside the project. No rules are generated to build it. The target name has scope in the directory in which it is created and below. It may be referenced like any target built within the project. IMPORTED libraries are useful for convenient reference from commands like target_link_libraries. Details about the imported library are specified by setting properties whose names begin in "IMPORTED_". The most important such property is IMPORTED_LOCATION (and its per-configuration version IMPORTED_LOCATION_<CONFIG>) which specifies the location of the main library file on disk. See documentation of the IMPORTED_* properties for more information.