Cmake tips

  • When adding an install target (so that your library/file is installed during “make install"), you use:
    install(TARGETS <target> DESTINATION <path>).
    <target> is what you used in your add_library (or add_executable).
    The <path> is somewhat tricky. If the path is not absolute, then cmake will automatically add CMAKE_INSTALL_PREFIX to the generated cmake_install file.
    For example:
    install(TARGETS mylib DESTINATION "path/to/lib") will result in: FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/path/to/lib" ... inside the cmake_install.cmake file.
    A common mistake is to do: install(TARGETS mylib DESTINATION "${CMAKE_INSTALL_PREFIX}/path/to/lib")
    which will generate: FILE(INSTALL DESTINATION “/whatever-CMAKE_INSTALL_PREFIX-was-during-cmake/path/to/lib” which is not what you want (it will use the CMAKE_INSTALL_PREFIX value at cmake time and “hardcode” it inside cmake_install.cmake). If, then, you run something like:
    cmake install -DCMAKE_INSTALL_PREFIX=new/path -P cmake_install.cmake
    it will not use the new/path.
  • When explicitly specifying library names in CMakeLists or via -D flag in the cmake command line, here is something to keep in mind:
    The actual library file name might be something like libfoo.so (or libfoo.dylib) but the name you specify in the -l option is without the “lib” prefix, like so: -lfoo. If you specify -llibfoo it won’t find it.

Cmake tips

RTC – how to hide widget header in dashboard

Here is a quick RTC (Rational Team Concert) tip.
When trying to make your team dashboard look nicer, you can hide the widget header by default. This is especially handy for HTML widget when using that widget as section separator (for readability).
For example, here is the view with the default – headers shown:Screen Shot 2017-10-05 at 12.17.26
You can observe the HTML headers showing up in the widgets. Note that you could change the title from default “HTML” to something less noticeable (I changed it to a “.” in the middle widget that says For Reviewers. You cannot have an empty title), but it still shows the icon and the header bar.
Here is the view with the headers hidden:Screen Shot 2017-10-05 at 12.30.31

You can see there are no more ugly headers and looks much better.

Here is how you do this.
In the widget header, select the Menu (little triangle icon) and then Appearance.
Under appearance, choose to remove the header background (the last icon in the list of background boxes, the one with a red line across). Once you select it, you will see an option to “Hide Header” in the upper right of the widget. Click it to hide the header and then click OK and don’t forget to click Save to save the dashboard:
Screen Shot 2017-10-05 at 12.39.15

 

RTC – how to hide widget header in dashboard