samedi 25 avril 2015

CMake. Create coverage target


Sorry for such popular question. But I can't correspondingly apply answers from here to my environment.

I have api and tests to it. Both are subprojects to main "dummy" project. I stuck because I used CMake-anitpattern:

cmake_minimum_required (VERSION 2.8)
set(CMAKE_SKIP_RPATH FALSE)
add_subdirectory ( src )
add_subdirectory ( test )

add_custom_target(coverage
    COMMAND make
    COMMAND sh ${CMAKE_SOURCE_DIR}/do_coverage.sh
)

That COMMAND make is bad solution because I planning to build my project on Windows later (yep, I need put commands from sh-script in CMakeLists.txt for this purpose too).

So, how can I let CMake to build test project in automatic mode for doing coverage things (gcov, gcovr) even if after cmake I want to make coverage straightway? Thanks!


Aucun commentaire:

Enregistrer un commentaire