From b10fc88bb0d5c6c31a797ab4e2010cdcac37b903 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Mon, 23 Jan 2017 14:02:08 -0200 Subject: [PATCH] EflMacros: build tests before running them. 'make test' wouldn't build the test, which is annoying. There is no way to add dependencies to reserved target 'test'. The test is also executed by another tool (ctest), not cmake itself, then we must create a test '-build' that is actually calling back cmake to compile the test suite and make it a dependency for the test itself. Nasty but improves usability. --- cmake/helpers/EflMacros.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/helpers/EflMacros.cmake b/cmake/helpers/EflMacros.cmake index 13e2493aa9..67a80ab167 100644 --- a/cmake/helpers/EflMacros.cmake +++ b/cmake/helpers/EflMacros.cmake @@ -766,6 +766,9 @@ function(EFL_TEST _testname) add_test(NAME ${_testname} COMMAND ${_testtarget}) LIST_APPEND_GLOBAL(${EFL_LIB_CURRENT}_TESTS ${_testtarget}) + + add_test(${_testname}-build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_testtarget}) + set_tests_properties(${_testname} PROPERTIES DEPENDS ${_testname}-build) endfunction() # EFL_MODULE(Name)