From 16b964d04d9c3a343fe27be86135154425177fd3 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Wed, 23 Aug 2017 15:01:48 +0300 Subject: [PATCH] cmake: Avoiding check target conflicts. [#CHEBOTAREV-14] --- cmake/add_check.cmake | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/add_check.cmake b/cmake/add_check.cmake index 1f93c5bcfd7..c6abbcdb321 100644 --- a/cmake/add_check.cmake +++ b/cmake/add_check.cmake @@ -1,14 +1,16 @@ # Adding test output on failure enable_testing () -if (CMAKE_CONFIGURATION_TYPES) - add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} - --force-new-ctest-process --output-on-failure --build-config "$" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -else () - add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} - --force-new-ctest-process --output-on-failure - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +if (NOT TARGET check) + if (CMAKE_CONFIGURATION_TYPES) + add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure --build-config "$" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + else () + add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} + --force-new-ctest-process --output-on-failure + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + endif () endif () macro (add_check target)