[CMake] test depending on code compilation

Mario Werner mario.werner at iaik.tugraz.at
Thu Jan 11 10:27:18 EST 2018


On 2018-01-10 10:47, Franck Houssen wrote:
> [snip]
> 
> The 2 unexpected problems I have left are:
> 1) mytestexe is compiled everytime I type "make" which is a solution but
> is not really what I am looking for (also compiled when I type "make
> check" which is expected).
>     => is there a way for make not to compile mytestexe (note I didn't
> added ALL in add_custom_target so I am not sure to know why make builds
> mytestexe)

You have to excluded mytestexe from the ALL target if you do not want
that it gets built by default [1]. (e.g., add EXCLUDE_FROM_ALL to
add_executable [2])

> 2) Also the verbosity is broken with check : make test ARGS="-V" is
> verbose , but, make check ARGS="-V" is not.
>     => how to deal with that ?
> 
> 

Can't help you there. I usually simply use `make check` to build and run
the full test suite in order to get an overview. Afterwards, I directly
call `ctest` with the desired arguments, for example when triaging a bug.

HTH,
Mario


[1] https://cmake.org/cmake/help/v3.0/prop_tgt/EXCLUDE_FROM_ALL.html
[2]
https://cmake.org/cmake/help/v3.0/command/add_executable.html?highlight=EXCLUDE_FROM_ALL



More information about the CMake mailing list