CMake/CTest & gcovr: filename extensions? - cmake

After compiling with CMake with flags --coverage, and running my boost unit test programs, files with extension .cpp.gcda and .cpp.gcno are created. If I then run gcovr it claims it cannot find the .gcno files (error message ".gcno:cannot open graph file"). I could possibly move all output files but that would be really awkward/silly.
Related problems of other people could be solved by using CTest but as I am using Jenkins I'd like to stick to gcovr and use the cobertura xml output.
Ps. Maybe I should simply ask: how should I combine CMake with gcovr?

This is the solution we are using for the same setup inside jenkins: http://www.semipol.de/archives/320. You can simply grab the CMake macro from the linked RSC library for your own purposes.
Apart from that read something about a slightly changed format of the coverage files in recent gcc versions and it seems gcovr didn't keep up with that. But I cannot remember where I read this.

Related

How to build latex documentation with CMake?

Situation:
a small CMake C++ project
with a /doc folder, currently built via a custom Makefile in it.
Problems:
CMake and GNU make are two separate build systems and it is laughable to use more than one for a small and simple project.
make help does not list a doc target
Tried solutions:
Googled the problem, got suggested to use add_custom_target(). That sounds like the wrong solution because regenerating the target .pdf every time is ... I can't call it "inefficient" as it takes a couple of seconds. But is against C++'s ideal of "pay for only what you use" - yes.
How to generate documentation from .tex files given a working makefile is already present? With CMake.

Using CMake in Embarcadero

I am trying to get CMake to work with Embarcadero 10.2.3 (Tokyo). I see a some help and blogs. I looks fine (I haven't tried so far), but I get confused about the existing cbproj file that I have. I get the impression that I need a CMake file list (CMakeLists.txt) as well as a cbproj file, if I need to build from the IDE. So in that case, any time I need to add files or settings I need to do in both. Is this true?
Thanks.

Building Google Talk (aka. WebRTC) PeerConnection Example

The WebRTC library getting started guide explains how to compile the library.
The sample programs in ./trunk/talk/examples/peerconnection are not built, however, and there are no make files in those directories to do this.
Can someone explain how to compile this, and perhaps the other Talk example programs on Linux?
I've been able to build them using the ninja build tool. I don't know if building using make is supported as well.
When you've checked out the code, you should have subdirectories trunk/out/Debug and trunk/out/Release. In them, there should be build.ninja files. Just go to one of those directories and type ninja to start the build. The peerconnection executables will be peerconnection_client and peerconnection_server in the Debug or Release directory.
In case the ninja build files need to be regenerated, you can execute gyp_webrtc from the trunk/webrtc/build subirectory

cmake suppress finding package and set path manually

I'm currently automating my the installation process for multiple instances of an application. This application uses cmake for building and uses some libraries for which no findModule.cmake files exist. Since I'm could find a good example how to generate a findModule.cmake file for existing libraries for example OpenCascade. When setting up the buildprocess manually one can easily adapt the include and lib path in ccmake. Since I want to automate this I'm looking for a way to do this by passing the options to cmake on the command line. Here is how I try to achieve this for OpenCascade:
cmake -DOCC_FOUND:INTERNAL=TRUE -DOCC_INCLUDE_DIR:PATH=/usr/include/opencascade -DOCC_LIBRARY:FILEPATH=/usr/lib/libTKernel.so -DCMAKE_BUILD_TYPE:STRING=Release ..
Unfortunately this doesn't work. Since the option for building are build-depended, passing a previously configured CMakeCache.txt file is not working.
Thanks for any suggestions to achieve what I'm trying to do.

What is the correct way to customize the install output directory for each developer in CMake?

I've been working on an old game that I created CMake files for to get rid of a mix of Makefiles and visual studio projects. Everything is working well, but I'm having a hard time figuring out what the correct way to allow the developer to specify where the output files are copied to when install is run.
The issue is there are many DLLs and some custom targets that need their output copied into a directory structure that includes the game data (levels, art, sound, etc) before they can test the code.
My install commands currently uses a variable that I 'SET' at the top level CMakeLists.txt to specify the output directory. I've tried overriding it with -DD3_GAMEDIR on the cmake command line. That variable gets set in the CMakeCache, but the SET command appears to override it still.
Should I be checking the length of the variable before using SET to see if the user specified a value? That seems like a hack to me, but I'm having a hard time finding the correct way to do it.
Thanks!
The install target supports the DESTDIR parameter, so you could do something like:
make install DESTDIR="C:\RootGameDir"
The other option is to only set the variable if it isn't already set (if(myVar)), but I personally prefer the DESTDIR solution.
Here is the anwser, according your cmake version:
SET(CMAKE_VERSION "${CMAKE_CACHE_MAJOR_VERSION}.${CMAKE_CACHE_MINOR_VERSION}")
IF("${CMAKE_VERSION}" STRGREATER "2.4")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY /path/of/your/install/${CMAKE_BUILD_TYPE}/bin)
SET(CMAKE_LIBRARY_OUTPUT_PATH /path/of/your/install/${CMAKE_BUILD_TYPE}/lib)
ELSE("${CMAKE_VERSION}" STRGREATER "2.4")
SET(EXECUTABLE_OUTPUT_PATH /path/of/your/install/${CMAKE_BUILD_TYPE}/bin)
SET(LIBRARY_OUTPUT_PATH /path/of/your/install/${CMAKE_BUILD_TYPE}/lib)
ENDIF("${CMAKE_VERSION}" STRGREATER "2.4")
What about using the various CMAKE_INSTALL_PREFIX, PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR?