Articles tagged work-planet

  1. Relative RPath Settings with CMake

    The run-time search path (rpath) defines paths to search for dynamic libraries when executing a program. It is a mechanism on Linux parallel to the LD_LIBRARY_PATH environment variable, which is another hint to find dynamic libraries.

    Usually, it is a good idea to make software which you built relocatable. This means that created binaries can be...

    Read more
  2. Using Dependency Tracking in Jenkins with CMake-based C++ Projects

    If you are building multiple related software projects with a continuous integration server one important aspect is to be notified when changes in an upstream job break the build or tests for a downstream job. This involves knowing which exact build numbers of the upstream and the downstream job are involved.

    The Jenkins continuous integration server...

    Read more
  3. Gcov Coverage Reports in Jenkins

    I am currently evaluating the applicability and limitations of the Jenkins continuous integration server for C++ development. Besides several limitations which are mainly caused by the complexity of C++, Jenkins provides a solid basis for continuous integration of C++ projects.

    One thing which I was not happy with so far was the missing integration...

    Read more
  4. Evaluation of Default Arguments in Python

    Today I stumbled upon a very subtle problem with default arguments in python. I noticed that loading a python module already instantiated one of my classes even though I could not find an installation of this class. In the end it turned out to be a default argument for a function:

    def foo(arg=MyClass()):

    As I am currently programming...

    Read more
  5. Boost bind and smart pointers

    I've seen this several times causing troubles:

    boost::shared_ptr<Foo> p(new Foo);
    boost::thread t(boost::bind(&Foo::method, p.get()))

    This prevents the livecycle management of shared_ptr or any other smart pointer to be effective in the thread. Hence, p may get destructed even though the thread is still active.

    Boost bind can handle smart...

    Read more
  6. bash: Home Directory Not Replaced With Tilde (~)

    After switching my computers to Arch Linux, reusing the existing home directories, I had the problem that the bash did not replace the user's home directory with the tilde character (~) in the prompt. The solutions for this problem is easy: somewhere in the bash-internals a check tests whether the output of pwd matches the contents of $HOME. $HOME

    Read more
  7. Ignoring Warnings from System Headers

    Compiling C and C++ code with the highest warning levels is a good practice and helps spotting potential errors. For GCC the flags

    -Wall -Wextra

    will generate a lot of useful warning messages about unused parameters etc.

    Unfortunately, this is not the common practice and often the own compiler settings concerning the warning level results in...

    Read more
  8. Unused Parameters in C++

    Just some quick thought on how to handle compiler warnings about unused parameters in C++ code. While these warnings are helpful most of the time, sometimes you simply have to ignore a parameter that is required by an interface definition. Then you got three solutions to remove the warning:

    1. Change the compiler flags. The worst solution....

    Read more
  9. CMake: installing headers and preserving the directory structure

    CMake doesn't provide a dedicated way to install header files (except for mac). What I wanted to do was to install all headers of my project using the same directory structure as in the source tree. This isn't as easy as it sounds. Assume you have a list of header files:

    SET(HS folder/test.h folder/other/test2.h)

    A simple call to INSTALL doesn...

    Read more
  10. Using googlemock with the Boost Test Library

    googlemock is a framework that allows generating mock objects for unit tests. I've decided to use this framework as it looks wells designed and maintained. The default is to use googlemock with Google's unit testing framework googletest, but as I was already using the Boost Testing Library, I was searching for a solution to use googlemock in Boost...

    Read more
  11. Doxygen Support in Eclipse CDT

    Since a long time I was wondering why CDT, the C++ support for the Eclipse IDE, doesn't have a decent support for highlighting and creating comments in the Doxygen format. Today, while searching for customizable code templates per project, I found the setting to enable Doxygen support. It is located in the project properties at "C/C++ General". Not...

    Read more
  12. Out-of-Source Builds mit CMake

    In der Java-Welt gibt es schon lange die sinnvolle Konvention kompilierte class-Dateien in einer anderen Verzeichnisstruktur abzulegen als den Quellcode. So eine eine Konvention hat viele Vorteile:

    • Falls der Quellcode in ein Versionskontrollsystem eingecheckt wird (und das sollte er auf jeden Fall), müssen nicht umständliche Regeln zum Excluden...
    Read more