From 14d30a1a146216089e2579257239c4f6ddc16a6c Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 9 Sep 2020 12:03:55 -0400 Subject: [PATCH 1/3] [cmake] Do not warn about unkown warning options --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9d9039..a1de305 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,7 @@ target_compile_options(${PROJECT_NAME}_warnings -Wpedantic -Wno-sign-compare -Wno-deprecated-comma-subscript + -Wno-unknown-warning-option $<$:-Wshadow=local> $<$:-Wno-attributes> $<$:-Wshadow> From 5dbd12f165e05972dfc594e1d8379299fb5b2703 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 9 Sep 2020 15:51:00 -0400 Subject: [PATCH 2/3] [cmake] Use FindGit.cmake in external_dependency.cmake, Improve error message on clone failure --- deps/external_dependency.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake index 19dd26d..252cead 100644 --- a/deps/external_dependency.cmake +++ b/deps/external_dependency.cmake @@ -72,9 +72,18 @@ function(external_dependency) set(src_dir ${bin_dir}_src) if(NOT IS_DIRECTORY ${src_dir}) if(ARG_GIT_TAG) - set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false) + set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false) + endif() + if(NOT GIT_EXECUTABLE) + find_package(Git REQUIRED) + endif() + execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir} + RESULT_VARIABLE clone_failed + ERROR_VARIABLE clone_error + ) + if(clone_failed) + message(FATAL_ERROR "Failed to clone sources for dependency ${ARGV0}.\n ${clone_error}") 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() From 76cb6414f6961f38a318185e486213c7446224d8 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Thu, 10 Sep 2020 10:11:41 -0400 Subject: [PATCH 3/3] [cmake] Properly suppress comma subscript warning on both clang and gcc --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1de305..9d7a0ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,12 +103,15 @@ target_compile_options(${PROJECT_NAME}_warnings -Wextra -Wpedantic -Wno-sign-compare - -Wno-deprecated-comma-subscript - -Wno-unknown-warning-option + $<$:-Wno-comma-subscript> $<$:-Wshadow=local> $<$:-Wno-attributes> + $<$:-Wno-deprecated-comma-subscript> + $<$:-Wno-unknown-warning-option> $<$:-Wshadow> $<$:-Wno-gcc-compat> + $<$:-Wno-deprecated-comma-subscript> + $<$:-Wno-unknown-warning-option> $<$:-Wshadow> $<$:-Wno-gcc-compat> )