cmake: improve check target(s) deps (#2571)

* cmake: use add_custom_target/add_dependencies instead of CHECK_TARGETS

This makes it fail in case of errors explicitly.  Previously appending
to CHECK_TARGETS in tests/examples/CMakeLists.txt was silently ignored.

* cmake: check: depend on check-unit always

Without busted this will print a message only, but that is good to have.
(I was confused why "check" would not depend on "check-unit" when
looking at the generated Makefile (which was caused due to some luarocks
environment being active without busted))
This commit is contained in:
Daniel Hahler 2019-01-11 17:03:32 +01:00 committed by GitHub
parent 3804040dbe
commit d00d3d4702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -38,8 +38,6 @@ include_directories(
${AWESOME_REQUIRED_INCLUDE_DIRS}
${AWESOME_OPTIONAL_INCLUDE_DIRS})
set(CHECK_TARGETS check-integration)
set(AWE_ICON_DIR ${SOURCE_DIR}/icons)
set(AWE_THEMES_DIR ${SOURCE_DIR}/themes)
@ -397,6 +395,8 @@ endif()
# }}}
# {{{ Tests
add_custom_target(check DEPENDS check-integration)
add_executable(test-gravity tests/test-gravity.c)
target_link_libraries(test-gravity
${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_REQUIRED_LDFLAGS})
@ -413,7 +413,7 @@ add_custom_target(check-themes
COMMENT "Testing themes"
USES_TERMINAL
DEPENDS generated_icons generate_awesomerc ${PROJECT_AWE_NAME})
list(APPEND CHECK_TARGETS check-themes)
add_dependencies(check check-themes)
add_custom_target(check-requires
lua "${CMAKE_SOURCE_DIR}/build-utils/check_for_invalid_requires.lua"
@ -434,12 +434,13 @@ if(BUSTED_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running unit tests"
VERBATIM)
list(APPEND CHECK_TARGETS check-unit)
else()
add_custom_target(check-unit true
COMMENT "Skipping check-unit, since busted was not found (during configuration)"
VERBATIM)
endif()
add_dependencies(check check-unit)
a_find_program(LUACHECK_EXECUTABLE luacheck FALSE)
if(LUACHECK_EXECUTABLE)
add_custom_target(luacheck
@ -450,7 +451,7 @@ if(LUACHECK_EXECUTABLE)
list(APPEND CHECK_QA_TARGETS luacheck)
endif()
add_custom_target(check-qa DEPENDS ${CHECK_QA_TARGETS})
add_custom_target(check DEPENDS ${CHECK_TARGETS} check-qa)
add_dependencies(check check-qa check-examples)
# }}}
INCLUDE(${CMAKE_SOURCE_DIR}/Packaging.cmake)