From 8c407831c810d0c7400fd313988837184b470e52 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Tue, 28 Apr 2020 10:51:06 -0400 Subject: [PATCH] [cmake] Improve command line output for dependency configuration --- deps/external_dependency.cmake | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake index 6ee16da1..56e9b79e 100644 --- a/deps/external_dependency.cmake +++ b/deps/external_dependency.cmake @@ -5,34 +5,34 @@ function(external_dependency) # Was dependency already found? if(${ARGV0}_FOUND) message(STATUS "Dependency ${ARGV0} was already resolved") - endif() - - if(NOT Build_Deps) - find_package(${ARGV0} ${${ARGV0}_VERSION} QUIET) - endif() - if(${ARGV0}_FOUND) - message(STATUS "Found dependency ${ARGV0} with find_package command") else() - message(STATUS "Building Dependency ${ARGV0} from source.") - if(ARG_EXCLUDE_FROM_ALL) - set(subdir_opts EXCLUDE_FROM_ALL) + if(NOT Build_Deps) + find_package(${ARGV0} ${${ARGV0}_VERSION} QUIET) endif() - if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}) - message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.") - add_subdirectory(${ARGV0} ${subdir_opts}) - elseif(ARG_GIT_REPO) - set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0}) - set(src_dir ${bin_dir}_src) - if(NOT IS_DIRECTORY ${src_dir}) - if(ARG_TAG) - set(clone_opts --branch ${ARG_TAG} -c advice.detachedHead=false) - endif() - execute_process(COMMAND git clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir}) - endif() - add_subdirectory(${src_dir} ${bin_dir} ${subdir_opts}) + if(${ARGV0}_FOUND) + message(STATUS "Found dependency ${ARGV0} with find_package command") else() - message(FATAL_ERROR "Could not find dependency ${ARGV0}") + message(STATUS " =============== Configuring Dependency ${ARGV0} =============== ") + if(ARG_EXCLUDE_FROM_ALL) + set(subdir_opts EXCLUDE_FROM_ALL) + endif() + if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}) + message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.") + add_subdirectory(${ARGV0} ${subdir_opts}) + elseif(ARG_GIT_REPO) + set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0}) + set(src_dir ${bin_dir}_src) + if(NOT IS_DIRECTORY ${src_dir}) + if(ARG_TAG) + set(clone_opts --branch ${ARG_TAG} -c advice.detachedHead=false) + endif() + execute_process(COMMAND git clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir}) + endif() + add_subdirectory(${src_dir} ${bin_dir} ${subdir_opts}) + else() + message(FATAL_ERROR "Could not find dependency ${ARGV0}") + endif() + set(${ARGV0}_FOUND TRUE PARENT_SCOPE) endif() - set(${ARGV0}_FOUND TRUE CACHE BOOL "Was dependency ${ARGV0} found?") endif() endfunction()