diff --git a/MyxCMake/lib/uncrustify/Uncrustify.cmake b/MyxCMake/lib/uncrustify/Uncrustify.cmake index 233dbbf..84efdde 100644 --- a/MyxCMake/lib/uncrustify/Uncrustify.cmake +++ b/MyxCMake/lib/uncrustify/Uncrustify.cmake @@ -9,10 +9,6 @@ function(myx_uncrustify TARGET_NAME) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT}) endif() - if(NOT ${PROJECT_BINARY_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - return() - endif() - set(options) set(oneValueArgs CONFIG) set(multiValueArgs) @@ -32,6 +28,12 @@ function(myx_uncrustify TARGET_NAME) return() endif() + get_filename_component(CONFIG_DIR ${ARG_CONFIG} DIRECTORY) + if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CONFIG_DIR}") + myx_message("MyxCMake: skip uncrustify for project ${PROJECT_NAME}") + return() + endif() + if(NOT TARGET myx-uncrustify) add_custom_target(myx-uncrustify) endif()