uncrustify выполняется только с файлом настройки из каталога CMAKE_SOURCE_DIR

This commit is contained in:
Andrei Astafev 2023-07-31 15:24:55 +03:00
parent 969667e9b1
commit 5086bfe47c

View File

@ -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()