From f1b574cd50cc97fc5dd4c20255140ca3e0acd37c Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 19 Oct 2022 16:59:18 +0300 Subject: [PATCH] 2.0.11 --- MyxxCMake/MyxxCMakeConfig.cmake | 35 +++++++++++-------- MyxxCMake/lib/AnalyzeClangCheck.cmake | 4 ++- MyxxCMake/lib/AnalyzeClangTidy.cmake | 16 +++++---- MyxxCMake/lib/AnalyzeClazy.cmake | 12 ++++--- MyxxCMake/lib/AnalyzePvsStudio.cmake | 14 ++++---- MyxxCMake/lib/Coverage.cmake | 5 ++- MyxxCMake/lib/sanitizers/FindSanitizers.cmake | 4 +++ VERSION | 2 +- 8 files changed, 58 insertions(+), 34 deletions(-) diff --git a/MyxxCMake/MyxxCMakeConfig.cmake b/MyxxCMake/MyxxCMakeConfig.cmake index c53db17..9d48d39 100644 --- a/MyxxCMake/MyxxCMakeConfig.cmake +++ b/MyxxCMake/MyxxCMakeConfig.cmake @@ -38,24 +38,31 @@ function(myxx) return() endif() - get_property(targets DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY BUILDSYSTEM_TARGETS) - foreach(iter ${targets}) - get_target_property(target_type ${iter} TYPE) - if((NOT ${target_type} STREQUAL "UTILITY") AND - (NOT ${iter} MATCHES ".*_shared$" ) AND - (NOT ${iter} MATCHES ".*_static$" ) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() + + get_property(__targets DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY BUILDSYSTEM_TARGETS) + foreach(__iter ${__targets}) + get_target_property(__target_type ${__iter} TYPE) + + if((NOT ${__target_type} STREQUAL "UTILITY") AND + (NOT ${__target_type} STREQUAL "INTERFACE_LIBRARY") AND + (NOT ${__iter} MATCHES ".*_shared$" ) AND + (NOT ${__iter} MATCHES ".*_static$" ) ) - myxx_code_coverage(${iter}) - myxx_analyze_clang_tidy(${iter}) - myxx_analyze_clang_tidy_naming(${iter}) - myxx_analyze_clang_check(${iter}) + message(${__target_type} ${__iter}) + myxx_code_coverage(${__iter}) + myxx_analyze_clang_tidy(${__iter}) + myxx_analyze_clang_tidy_naming(${__iter}) + myxx_analyze_clang_check(${__iter}) if(MYXX_CMAKE_CLAZY_FIX) - myxx_analyze_clazy(${iter} FIX) + myxx_analyze_clazy(${__iter} FIX) else() - myxx_analyze_clazy(${iter}) + myxx_analyze_clazy(${__iter}) endif() - myxx_analyze_pvs_studio(${iter}) - myxx_add_sanitizers(${iter}) + myxx_analyze_pvs_studio(${__iter}) + myxx_add_sanitizers(${__iter}) endif() endforeach() endfunction(myxx) diff --git a/MyxxCMake/lib/AnalyzeClangCheck.cmake b/MyxxCMake/lib/AnalyzeClangCheck.cmake index a9fad62..4b03290 100644 --- a/MyxxCMake/lib/AnalyzeClangCheck.cmake +++ b/MyxxCMake/lib/AnalyzeClangCheck.cmake @@ -14,7 +14,9 @@ find_program(CLANG_CHECK_EXE NAMES ${CLANG_CHECK_NAMES}) unset(CLANG_CHECK_NAMES) function(myxx_analyze_clang_check TARGET_NAME) - myx_skip_external_target(${TARGET_NAME}) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() if(NOT CLANG_CHECK_EXE) message(STATUS "MyxCMake: Clang Check analyzer is not found") diff --git a/MyxxCMake/lib/AnalyzeClangTidy.cmake b/MyxxCMake/lib/AnalyzeClangTidy.cmake index fa5a6bd..19aa1ff 100644 --- a/MyxxCMake/lib/AnalyzeClangTidy.cmake +++ b/MyxxCMake/lib/AnalyzeClangTidy.cmake @@ -14,7 +14,9 @@ find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY_NAMES}) unset(CLANG_TIDY_NAMES) function(myxx_analyze_clang_tidy TARGET_NAME) - myx_skip_external_target(${TARGET_NAME}) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() if(NOT CLANG_TIDY_EXE) message(STATUS "MyxxCMake: Clang Tidy analyzer is not found") @@ -55,7 +57,9 @@ endfunction() function(myxx_analyze_clang_tidy_naming TARGET_NAME) - myx_skip_external_target(${TARGET_NAME}) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() if(NOT CLANG_TIDY_EXE) message(STATUS "MyxxCMake: Clang Tidy analyzer is not found") @@ -82,10 +86,10 @@ function(myxx_analyze_clang_tidy_naming TARGET_NAME) set(__cmd_args -extra-arg="-Wno-unknown-warning-option ${ARG_EXTRA_ARGS}") get_target_property(__sources ${TARGET_NAME} SOURCES) - foreach(iter ${__sources}) - string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) - if(pos EQUAL -1) - list(APPEND __filtered_sources ${iter}) + foreach(__iter ${__sources}) + string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos) + if(__pos EQUAL -1) + list(APPEND __filtered_sources ${__iter}) endif() endforeach() diff --git a/MyxxCMake/lib/AnalyzeClazy.cmake b/MyxxCMake/lib/AnalyzeClazy.cmake index 1f3d182..bfba760 100644 --- a/MyxxCMake/lib/AnalyzeClazy.cmake +++ b/MyxxCMake/lib/AnalyzeClazy.cmake @@ -7,7 +7,9 @@ if(CLAZY_EXE AND CLANG_APPLY_REPLACEMENTS_EXE) endif() function(myxx_analyze_clazy TARGET_NAME) - myx_skip_external_target(${TARGET_NAME}) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() if(NOT CLAZY_EXE) message(STATUS "MyxCMake: Clazy standalone analyzer is not found") @@ -36,10 +38,10 @@ function(myxx_analyze_clazy TARGET_NAME) -extra-arg=-Wno-unknown-warning-option -export-fixes=clazy-fixes-file.yaml) get_target_property(__sources ${TARGET_NAME} SOURCES) - foreach(iter ${__sources}) - string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) - if(pos EQUAL -1) - list(APPEND __filtered_sources ${iter}) + foreach(__iter ${__sources}) + string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos) + if(__pos EQUAL -1) + list(APPEND __filtered_sources ${__iter}) endif() endforeach() diff --git a/MyxxCMake/lib/AnalyzePvsStudio.cmake b/MyxxCMake/lib/AnalyzePvsStudio.cmake index 5d096af..7ca2d75 100644 --- a/MyxxCMake/lib/AnalyzePvsStudio.cmake +++ b/MyxxCMake/lib/AnalyzePvsStudio.cmake @@ -10,7 +10,9 @@ function(myxx_analyze_pvs_studio TARGET_NAME) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYXX_CMAKE_LIB_PVS_DIR_BACKPORT}) endif() - myx_skip_external_target(${TARGET_NAME}) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() if(NOT PVS_STUDIO_ANALYZER_EXE) message(STATUS "MyxxCMake: pvs-studio-analyzer not found.") @@ -37,11 +39,11 @@ function(myxx_analyze_pvs_studio TARGET_NAME) set(ARG_MODE "GA:1,2,3;64:1,2;OP:1,2,3;CS:1,2;OWASP:1,2") endif() - get_target_property(sources ${TARGET_NAME} SOURCES) - foreach(iter ${sources}) - string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) - if(pos EQUAL -1) - list(APPEND srcs ${iter}) + get_target_property(__target_sources ${TARGET_NAME} SOURCES) + foreach(__iter ${__target_sources}) + string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos) + if(__pos EQUAL -1) + list(APPEND __filtered_sources ${__iter}) endif() endforeach() diff --git a/MyxxCMake/lib/Coverage.cmake b/MyxxCMake/lib/Coverage.cmake index 15a6593..340c99c 100644 --- a/MyxxCMake/lib/Coverage.cmake +++ b/MyxxCMake/lib/Coverage.cmake @@ -9,7 +9,10 @@ function(myxx_code_coverage TARGET_NAME) if(NOT MYXX_CODE_COVERAGE) return() endif() - myx_skip_external_target(${TARGET_NAME}) + + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() set(options) set(oneValueArgs) diff --git a/MyxxCMake/lib/sanitizers/FindSanitizers.cmake b/MyxxCMake/lib/sanitizers/FindSanitizers.cmake index 3a6201e..0f88ec3 100644 --- a/MyxxCMake/lib/sanitizers/FindSanitizers.cmake +++ b/MyxxCMake/lib/sanitizers/FindSanitizers.cmake @@ -50,6 +50,10 @@ function(sanitizer_add_blacklist_file FILE) endfunction() function(myxx_add_sanitizers ...) + if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + return() + endif() + # If no sanitizer is enabled, return immediately. if(NOT (SANITIZE_ADDRESS diff --git a/VERSION b/VERSION index 0a69206..6cbacdc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.10 +2.0.11