From eff6831217c2b9badfce01ada55756f833e6388e Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Mon, 18 Dec 2017 19:57:04 +0300 Subject: [PATCH] [HIPIFY][cmake] Fix require_program function Function require_program erroneously doesn't report "Can't find program" on any missing program except the first one due to the cached FOUND_PROGRAM value. Additionally: + Do not throw FATAL_ERROR on missing program in order to obtain the whole list of missing programs (if any). + Report also found program location. --- hipamd/hipify-clang/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hipamd/hipify-clang/CMakeLists.txt b/hipamd/hipify-clang/CMakeLists.txt index da6eaeaa99..79d181528b 100644 --- a/hipamd/hipify-clang/CMakeLists.txt +++ b/hipamd/hipify-clang/CMakeLists.txt @@ -68,9 +68,11 @@ if (HIPIFY_CLANG_TESTS) find_package(PythonInterp 2.7 REQUIRED EXACT) function (require_program PROGRAM_NAME) - find_program(FOUND_PROGRAM ${PROGRAM_NAME}) - if (NOT FOUND_PROGRAM) - message(FATAL_ERROR "Can't find ${PROGRAM_NAME}. Either set HIPIFY_CLANG_TESTS to OFF to disable hipify tests, or install the missing program.") + find_program(FOUND_${PROGRAM_NAME} ${PROGRAM_NAME}) + if (FOUND_${PROGRAM_NAME}) + message(STATUS "Found ${PROGRAM_NAME}: ${FOUND_${PROGRAM_NAME}}") + else() + message(SEND_ERROR "Can't find ${PROGRAM_NAME}. Either set HIPIFY_CLANG_TESTS to OFF to disable hipify tests, or install the missing program.") endif() endfunction()