From 034fbffbcdff147eb931b7a39f72591703fcc1a8 Mon Sep 17 00:00:00 2001 From: Andrei Astafev Date: Thu, 28 Mar 2024 11:09:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20MyxCMake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/myx/MyxCMakeConfig.cmake | 7 +- cmake/myx/MyxCMakeConfigVersion.cmake | 2 +- cmake/myx/backports/TopLevelProject.cmake | 11 --- cmake/myx/lib/AddExecutable.cmake | 2 +- cmake/myx/lib/AddInterfaceLibrary.cmake | 70 ++++++++++++------- cmake/myx/lib/AddObjectLibrary.cmake | 16 ++--- cmake/myx/lib/DownloadContent.cmake | 8 +++ cmake/myx/lib/NinjaGeneratorWarning.cmake | 5 +- cmake/myx/lib/ProjectIsTopLevel.cmake | 15 ++++ cmake/myx/lib/TargetSetup.cmake | 47 +++++++------ cmake/myx/lib/TargetSetupQt.cmake | 40 ++++++----- cmake/myx/lib/Toolchains.cmake | 27 +++++-- cmake/myx/lib/doc/Doxygen.cmake | 4 +- cmake/myx/lib/generators/GitInfoHeader.cmake | 25 ++++--- .../lib/generators/PrivateConfigHeader.cmake | 17 +++-- .../macro/CheckEnableCxxCompilerFlag.cmake | 4 +- cmake/myx/lib/macro/CreateSymlink.cmake | 2 +- cmake/myx/lib/macro/FindPackages.cmake | 4 +- cmake/myx/lib/macro/FindQt.cmake | 4 +- cmake/myx/lib/macro/GTest.cmake | 4 +- cmake/myx/lib/macro/QTest.cmake | 8 +-- .../myx/lib/toolchains/AstraLinuxSE-1.5.cmake | 8 --- cmake/myx/lib/toolchains/Clang.cmake | 3 - cmake/myx/lib/toolchains/ElbrusD-1.4.cmake | 9 --- cmake/myx/lib/toolchains/GCC.cmake | 3 - cmake/myx/lib/uncrustify/Uncrustify.cmake | 49 +++++++------ cmake/myx_setup.cmake | 4 +- 27 files changed, 216 insertions(+), 182 deletions(-) delete mode 100644 cmake/myx/backports/TopLevelProject.cmake create mode 100644 cmake/myx/lib/ProjectIsTopLevel.cmake delete mode 100644 cmake/myx/lib/toolchains/AstraLinuxSE-1.5.cmake delete mode 100644 cmake/myx/lib/toolchains/Clang.cmake delete mode 100644 cmake/myx/lib/toolchains/ElbrusD-1.4.cmake delete mode 100644 cmake/myx/lib/toolchains/GCC.cmake diff --git a/cmake/myx/MyxCMakeConfig.cmake b/cmake/myx/MyxCMakeConfig.cmake index 6c04f4f..73b80d5 100644 --- a/cmake/myx/MyxCMakeConfig.cmake +++ b/cmake/myx/MyxCMakeConfig.cmake @@ -24,8 +24,7 @@ set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib") # Модули для обеспечения обратной совместимости со старыми версиями CMake include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake) -include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake) -if(${CMAKE_VERSION} VERSION_LESS "3.11.0") +if(${CMAKE_VERSION} VERSION_LESS 3.11) include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake) else() include(FetchContent) @@ -44,6 +43,7 @@ include(${MYX_CMAKE_LIB_DIR}/macro/CheckEnableCxxCompilerFlag.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/GTest.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/QTest.cmake) +include(${MYX_CMAKE_LIB_DIR}/ProjectIsTopLevel.cmake) include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake) include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake) include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake) @@ -53,10 +53,7 @@ include(${MYX_CMAKE_LIB_DIR}/SemanticProjectVersion.cmake) include(${MYX_CMAKE_LIB_DIR}/NinjaGeneratorWrapper.cmake) include(${MYX_CMAKE_LIB_DIR}/DownloadContent.cmake) -set(MYX_CMAKE_TOOLCHAINS_DIR "${MYX_CMAKE_LIB_DIR}/toolchains") include(${MYX_CMAKE_LIB_DIR}/Toolchains.cmake) -unset(MYX_CMAKE_TOOLCHAINS_DIR) - include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake) include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake) include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake) diff --git a/cmake/myx/MyxCMakeConfigVersion.cmake b/cmake/myx/MyxCMakeConfigVersion.cmake index 4243a9a..6fb62d5 100644 --- a/cmake/myx/MyxCMakeConfigVersion.cmake +++ b/cmake/myx/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.4.12") +set(MYX_CMAKE_PACKAGE_VERSION "2.4.33") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/cmake/myx/backports/TopLevelProject.cmake b/cmake/myx/backports/TopLevelProject.cmake deleted file mode 100644 index 953758f..0000000 --- a/cmake/myx/backports/TopLevelProject.cmake +++ /dev/null @@ -1,11 +0,0 @@ -include_guard(GLOBAL) - -if(${CMAKE_VERSION} VERSION_LESS 3.21) - get_property(__parent_directory DIRECTORY PROPERTY PARENT_DIRECTORY) - if(NOT __parent_directory) - set(PROJECT_IS_TOP_LEVEL TRUE) - else() - set(PROJECT_IS_TOP_LEVEL FALSE) - endif() - unset(__parent_directory) -endif() diff --git a/cmake/myx/lib/AddExecutable.cmake b/cmake/myx/lib/AddExecutable.cmake index 5d78070..d384ade 100644 --- a/cmake/myx/lib/AddExecutable.cmake +++ b/cmake/myx/lib/AddExecutable.cmake @@ -14,7 +14,7 @@ myx_add_executable include_guard(GLOBAL) function(myx_add_executable TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.11.0") + if(${CMAKE_VERSION} VERSION_LESS 3.11.0) add_executable(${TARGET_NAME} ${ARGN} "") else() add_executable(${TARGET_NAME} ${ARGN}) diff --git a/cmake/myx/lib/AddInterfaceLibrary.cmake b/cmake/myx/lib/AddInterfaceLibrary.cmake index f8eedd3..98fb9fd 100644 --- a/cmake/myx/lib/AddInterfaceLibrary.cmake +++ b/cmake/myx/lib/AddInterfaceLibrary.cmake @@ -20,12 +20,12 @@ include_guard(GLOBAL) include(CMakePackageConfigHelpers) -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17) set(MYX_CMAKE_LIB_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() function(myx_add_interface_library TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT}) endif() @@ -43,31 +43,46 @@ function(myx_add_interface_library TARGET_NAME) endif() # Вызов стандартной функции `add_library()` - if(${CMAKE_VERSION} VERSION_LESS "3.19.0") + if(${CMAKE_VERSION} VERSION_LESS 3.19) add_library(${TARGET_NAME} INTERFACE) target_sources(${TARGET_NAME} INTERFACE $) else() add_library(${TARGET_NAME} INTERFACE ${ARG_HEADERS}) endif() - - foreach(__iter ${ARG_PACKAGES}) - target_include_directories(${TARGET_NAME} INTERFACE ${${__iter}_INCLUDE_DIRS}) - target_compile_definitions(${TARGET_NAME} INTERFACE ${${__iter}_COMPILE_DEFINITIONS}) + foreach(iter ${ARG_PACKAGES}) + target_include_directories(${TARGET_NAME} INTERFACE ${${iter}_INCLUDE_DIRS}) + target_compile_definitions(${TARGET_NAME} INTERFACE ${${iter}_COMPILE_DEFINITIONS}) endforeach() if(ARG_LINK_LIBRARIES) - target_link_libraries(${TARGET_NAME} INTERFACE ${ARG_LINK_LIBRARIES}) - if(${CMAKE_VERSION} VERSION_GREATER "3.15.0") - foreach(__lib ${ARG_LINK_LIBRARIES}) - if(TARGET ${__lib}) - install( - TARGETS ${__lib} - EXPORT ${TARGET_NAME}Targets - COMPONENT DEV) + foreach(lib ${ARG_LINK_LIBRARIES}) + if(TARGET ${lib}) + set(exlib ${lib}) + get_target_property(type ${lib} TYPE) + if(type) + get_target_property(include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES) + if(include_dirs) + target_include_directories(${TARGET_NAME} INTERFACE ${include_dirs}) + endif() endif() - endforeach() - endif() + if(${CMAKE_VERSION} VERSION_GREATER 3.13) + install(TARGETS ${lib} + EXPORT ${TARGET_NAME}Targets + COMPONENT DEV) + else() + get_target_property(target_type ${lib} TYPE) + if(target_type STREQUAL "OBJECT_LIBRARY") + if(TARGET "${lib}_static") + set(exlib "${lib}_static") + elseif(TARGET "${lib}_shared") + set(exlib "${lib}_shared") + endif() + endif() + endif() + target_link_libraries(${TARGET_NAME} INTERFACE ${exlib}) + endif() + endforeach() endif() # Библиотека, состоящая только из заголовочных файлов не требует сборки. @@ -82,7 +97,7 @@ function(myx_add_interface_library TARGET_NAME) # При этом сама цель `${TARGET_NAME}` может участвовать в сборке, # если окажется в перечне зависимостей. if(NOT PROJECT_IS_TOP_LEVEL) - if(${CMAKE_VERSION} VERSION_GREATER "3.17.0") + if(${CMAKE_VERSION} VERSION_GREATER 3.17) set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL True) else() set_target_properties(${TARGET_NAME} PROPERTIES INTERFACE_EXCLUDE_FROM_ALL True) @@ -107,9 +122,12 @@ function(myx_add_interface_library TARGET_NAME) NO_CHECK_REQUIRED_COMPONENTS_MACRO ) - install(EXPORT ${TARGET_NAME}Targets - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET_NAME} - COMPONENT DEV) + if(${CMAKE_VERSION} VERSION_GREATER 3.13) + install( + EXPORT ${TARGET_NAME}Targets + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET_NAME} + COMPONENT DEV) + endif() install( FILES @@ -139,10 +157,12 @@ function(myx_add_interface_library TARGET_NAME) # Установка библиотеки из заголовочных файлов target_include_directories(${TARGET_NAME} SYSTEM INTERFACE $) - install( - TARGETS ${TARGET_NAME} - EXPORT ${TARGET_NAME}Targets - COMPONENT DEV) + if(${CMAKE_VERSION} VERSION_GREATER 3.13) + install( + TARGETS ${TARGET_NAME} + EXPORT ${TARGET_NAME}Targets + COMPONENT DEV) + endif() # Установка публичных заголовочных файлов if(PROJECT_IS_TOP_LEVEL AND ARG_HEADERS) diff --git a/cmake/myx/lib/AddObjectLibrary.cmake b/cmake/myx/lib/AddObjectLibrary.cmake index 58b16bf..1d43ee5 100644 --- a/cmake/myx/lib/AddObjectLibrary.cmake +++ b/cmake/myx/lib/AddObjectLibrary.cmake @@ -21,12 +21,12 @@ myx_add_object_library include_guard(GLOBAL) -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17) set(MYX_CMAKE_LIB_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() function(myx_add_object_library TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DIR_BACKPORT}) endif() @@ -44,12 +44,12 @@ function(myx_add_object_library TARGET_NAME) # Вызов стандартной функции `add_library()` add_library(${TARGET_NAME} OBJECT ${ARG_UNPARSED_ARGUMENTS}) - string(TOUPPER ${TARGET_NAME} __project_name_upper) + string(TOUPPER ${TARGET_NAME} project_name_upper) # Опция для разрешения сборки динамической библиотеки - cmake_dependent_option(${__project_name_upper}_BUILD_SHARED + cmake_dependent_option(${project_name_upper}_BUILD_SHARED "Build shared library for ${TARGET_NAME}" ON "BUILD_SHARED_LIBS" OFF) # Опция для разрешения сборки статической библиотеки - cmake_dependent_option(${__project_name_upper}_BUILD_STATIC + cmake_dependent_option(${project_name_upper}_BUILD_STATIC "Build static library for ${TARGET_NAME}" ON "NOT BUILD_SHARED_LIBS" OFF) # Стандартные пути к заголовочным файлам @@ -68,7 +68,7 @@ function(myx_add_object_library TARGET_NAME) if(NOT ARG_NO_EXPORT) include(GenerateExportHeader) if(NOT EXPORT_BASE_NAME) - set(ARG_EXPORT_BASE_NAME ${__project_name_upper}) + set(ARG_EXPORT_BASE_NAME ${project_name_upper}) endif() if(NOT ARG_EXPORT_FILE_NAME) @@ -89,7 +89,7 @@ function(myx_add_object_library TARGET_NAME) endif() # Цель для создания динамической библиотеки из объектных файлов - if(${__project_name_upper}_BUILD_SHARED) + if(${project_name_upper}_BUILD_SHARED) # Для создания динамической библиотеки используются объектные файлы цели ${TARGET_NAME} add_library(${TARGET_NAME}_shared SHARED $) # Установка дополнительных свойств для цели ${TARGET_NAME}_shared @@ -105,7 +105,7 @@ function(myx_add_object_library TARGET_NAME) endif() # Цель для создания статической библиотеки из объектных файлов - if(${__project_name_upper}_BUILD_STATIC) + if(${project_name_upper}_BUILD_STATIC) # Для создания статической библиотеки используются # объектные файлы цели ${TARGET_NAME} add_library(${TARGET_NAME}_static STATIC $) diff --git a/cmake/myx/lib/DownloadContent.cmake b/cmake/myx/lib/DownloadContent.cmake index 530a856..9cd4059 100644 --- a/cmake/myx/lib/DownloadContent.cmake +++ b/cmake/myx/lib/DownloadContent.cmake @@ -28,6 +28,10 @@ find_package(Git QUIET) option(ENABLE_DOWNLOAD_CONTENT "Enable download content" ON) +if(CMAKE_SCRIPT_MODE_FILE) + include(${CMAKE_CURRENT_LIST_DIR}/ProjectIsTopLevel.cmake) +endif() + function(myx_download_content NAME) set(options AUTOFETCH AUTOPULL) set(oneValueArgs) @@ -45,6 +49,10 @@ function(myx_download_content NAME) endif() endif() + if(NOT PROJECT_IS_TOP_LEVEL) + return() + endif() + if(NOT ARG_DOWNLOAD_DIR) set(ARG_DOWNLOAD_DIR "_downloads") endif() diff --git a/cmake/myx/lib/NinjaGeneratorWarning.cmake b/cmake/myx/lib/NinjaGeneratorWarning.cmake index a07ee69..7ef9ddd 100644 --- a/cmake/myx/lib/NinjaGeneratorWarning.cmake +++ b/cmake/myx/lib/NinjaGeneratorWarning.cmake @@ -1,8 +1,7 @@ -# Версии CMake, как минимум до 3.8.0, генерируют некорректные -# правила для ninja. +# Версии CMake, как минимум до 3.8, генерируют некорректные правила для ninja. include_guard(GLOBAL) -if(${CMAKE_VERSION} VERSION_LESS "3.8.0" AND CMAKE_GENERATOR MATCHES Ninja) +if(${CMAKE_VERSION} VERSION_LESS 3.8 AND CMAKE_GENERATOR MATCHES Ninja) myx_message_send_error("Myx: Old CMake versions should use Makefile generator") endif() diff --git a/cmake/myx/lib/ProjectIsTopLevel.cmake b/cmake/myx/lib/ProjectIsTopLevel.cmake new file mode 100644 index 0000000..eabd67e --- /dev/null +++ b/cmake/myx/lib/ProjectIsTopLevel.cmake @@ -0,0 +1,15 @@ +include_guard(GLOBAL) + +# Установка переменной, определяющей находится ли текущий +# проект на верхнем уровне. +# (Файл перемещён из каталога backports в lib для myx_download_content) +# +if(${CMAKE_VERSION} VERSION_LESS 3.21) + get_property(pd DIRECTORY PROPERTY PARENT_DIRECTORY) + if(NOT pd) + set(PROJECT_IS_TOP_LEVEL TRUE) + else() + set(PROJECT_IS_TOP_LEVEL FALSE) + endif() + unset(pd) +endif() diff --git a/cmake/myx/lib/TargetSetup.cmake b/cmake/myx/lib/TargetSetup.cmake index b65b05e..18ec31d 100644 --- a/cmake/myx/lib/TargetSetup.cmake +++ b/cmake/myx/lib/TargetSetup.cmake @@ -3,7 +3,8 @@ include_guard(GLOBAL) function(myx_target_setup TARGET_NAME) set(options) set(oneValueArgs PCH) - set(multiValueArgs COMPILE_DEFINITIONS PACKAGES LINK_LIBRARIES + set(multiValueArgs PACKAGES + COMPILE_DEFINITIONS INCLUDE_DIRECTORIES LINK_LIBRARIES CPP PUBLIC_HEADERS PRIVATE_HEADERS) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -11,8 +12,8 @@ function(myx_target_setup TARGET_NAME) myx_message_fatal_error("Target ${TARGET_NAME} does not exists.") endif() - get_target_property(__target_type ${TARGET_NAME} TYPE) - if(${__target_type} STREQUAL "INTERFACE_LIBRARY") + get_target_property(target_type ${TARGET_NAME} TYPE) + if(${target_type} STREQUAL "INTERFACE_LIBRARY") myx_message_fatal_error("This function will not work for interface targets.") endif() @@ -53,7 +54,7 @@ function(myx_target_setup TARGET_NAME) $) endif() - if(__target_type STREQUAL "EXECUTABLE") + if(target_type STREQUAL "EXECUTABLE") if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/include") target_include_directories(${PROJECT_NAME} PRIVATE $) @@ -76,40 +77,42 @@ function(myx_target_setup TARGET_NAME) target_sources(${TARGET_NAME} PUBLIC ${ARG_PUBLIC_HEADERS}) target_sources(${TARGET_NAME} PRIVATE ${ARG_CPP} ${ARG_PCH} ${ARG_PRIVATE_HEADERS}) - target_sources(${TARGET_NAME} PUBLIC $) target_compile_definitions(${TARGET_NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS}) + target_include_directories(${TARGET_NAME} PRIVATE ${ARG_INCLUDE_DIRECTORIES}) # CMake до версии 3.12 не умеет извлекать из целей типа `OBJECT_LIBRARY` # информацию о заголовочных файлах. Это обход. if(${CMAKE_VERSION} VERSION_GREATER "3.11.99") target_link_libraries(${TARGET_NAME} PRIVATE ${ARG_LINK_LIBRARIES}) else() - if((NOT ${__target_type} STREQUAL "OBJECT_LIBRARY") AND - (NOT ${__target_type} STREQUAL "EXECUTABLE")) + if((NOT ${target_type} STREQUAL "OBJECT_LIBRARY") AND + (NOT ${target_type} STREQUAL "EXECUTABLE")) target_link_libraries(${TARGET_NAME} PRIVATE ${ARG_LINK_LIBRARIES}) else() - foreach(__link_library ${ARG_LINK_LIBRARIES}) - if(TARGET ${__link_library}) - get_target_property(__lib_type ${__link_library} TYPE) - if(__lib_type) - get_target_property(__include_dirs ${__link_library} INTERFACE_INCLUDE_DIRECTORIES) - if(__include_dirs) - target_include_directories(${TARGET_NAME} PUBLIC ${__include_dirs}) + foreach(link_library ${ARG_LINK_LIBRARIES}) + if(TARGET ${link_library}) + get_target_property(library_type ${link_library} TYPE) + if(library_type) + get_target_property(include_dirs ${link_library} INTERFACE_INCLUDE_DIRECTORIES) + if(include_dirs) + target_include_directories(${TARGET_NAME} PUBLIC ${include_dirs}) endif() - if(${__target_type} STREQUAL "EXECUTABLE") - if(${__lib_type} STREQUAL "OBJECT_LIBRARY") - if(TARGET ${__link_library}_static) - target_link_libraries(${TARGET_NAME} PRIVATE ${__link_library}_static) + if(${target_type} STREQUAL "EXECUTABLE") + if(${library_type} STREQUAL "OBJECT_LIBRARY") + if(TARGET ${link_library}_static) + target_link_libraries(${TARGET_NAME} PRIVATE ${link_library}_static) else() - target_link_libraries(${TARGET_NAME} PRIVATE ${__link_library}_shared) - endif() + target_link_libraries(${TARGET_NAME} PRIVATE ${link_library}_shared) + endif() else() - target_link_libraries(${TARGET_NAME} PRIVATE ${__link_library}) + target_link_libraries(${TARGET_NAME} PRIVATE ${link_library}) endif() endif() endif() else() - target_link_libraries(${TARGET_NAME} PRIVATE ${__link_library}) + if((${CMAKE_VERSION} VERSION_GREATER "3.7.99") OR (NOT target_type STREQUAL "OBJECT_LIBRARY")) + target_link_libraries(${TARGET_NAME} PRIVATE ${link_library}) + endif() endif() endforeach() endif() diff --git a/cmake/myx/lib/TargetSetupQt.cmake b/cmake/myx/lib/TargetSetupQt.cmake index 893075c..6ff2163 100644 --- a/cmake/myx/lib/TargetSetupQt.cmake +++ b/cmake/myx/lib/TargetSetupQt.cmake @@ -16,36 +16,38 @@ function(myx_target_setup_qt TARGET_NAME) myx_message_fatal_error("Supported Qt versions are 5 and 6") endif() - get_target_property(__target_type ${TARGET_NAME} TYPE) + get_target_property(target_type ${TARGET_NAME} TYPE) foreach(iter ${ARG_COMPONENTS}) - if(__target_type STREQUAL "INTERFACE_LIBRARY") - target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_INCLUDE_DIRS}) + if(target_type STREQUAL "INTERFACE_LIBRARY") + target_include_directories(${TARGET_NAME} INTERFACE ${Qt${myx_qt_ver}${iter}_INCLUDE_DIRS}) else() - target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS}) - endif() - if(NOT iter STREQUAL "LinguistTools") - if(__target_type STREQUAL "EXECUTABLE") - target_link_libraries(${TARGET_NAME} PRIVATE Qt${myx_qt_ver}::${iter}) - endif() - if(__target_type STREQUAL "SHARED_LIBRARY") - target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter}) - endif() - if((${CMAKE_VERSION} VERSION_GREATER "3.8.0") AND (__target_type STREQUAL "OBJECT_LIBRARY")) - target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter}) + target_include_directories(${TARGET_NAME} PRIVATE ${Qt${myx_qt_ver}${iter}_INCLUDE_DIRS}) + if(NOT iter STREQUAL "LinguistTools") + if(target_type STREQUAL "EXECUTABLE") + target_link_libraries(${TARGET_NAME} PRIVATE Qt${myx_qt_ver}::${iter}) + endif() + if(target_type STREQUAL "SHARED_LIBRARY") + target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter}) + endif() + if((${CMAKE_VERSION} VERSION_GREATER 3.8.0) AND (target_type STREQUAL "OBJECT_LIBRARY")) + target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter}) + else() + target_include_directories(${TARGET_NAME} PUBLIC ${Qt${myx_qt_ver}${iter}_INCLUDE_DIRS}) + endif() endif() endif() endforeach() foreach(iter ${ARG_PRIVATE}) - if(__target_type STREQUAL "INTERFACE_LIBRARY") + if(target_type STREQUAL "INTERFACE_LIBRARY") target_include_directories(${TARGET_NAME} INTERFACE ${Qt${myx_qt_ver}${iter}_PRIVATE_INCLUDE_DIRS}) else() target_include_directories(${TARGET_NAME} PRIVATE ${Qt${myx_qt_ver}${iter}_PRIVATE_INCLUDE_DIRS}) endif() endforeach() - if(__target_type STREQUAL "EXECUTABLE") + if(target_type STREQUAL "EXECUTABLE") target_compile_options(${TARGET_NAME} PRIVATE ${Qt${myx_qt_ver}Core_EXECUTABLE_COMPILE_FLAGS}) endif() @@ -92,7 +94,7 @@ function(myx_target_setup_qt TARGET_NAME) endif() # Перечень файлов, подлежащих переводу - if(__target_type STREQUAL "INTERFACE_LIBRARY") + if(target_type STREQUAL "INTERFACE_LIBRARY") get_target_property(tr ${TARGET_NAME} INTERFACE_TR_FILES) else() get_target_property(tr ${TARGET_NAME} TR_FILES) @@ -136,7 +138,7 @@ function(myx_target_setup_qt TARGET_NAME) endif() endif() unset(tr) - if(__target_type STREQUAL "INTERFACE_LIBRARY") + if(target_type STREQUAL "INTERFACE_LIBRARY") target_sources(${TARGET_NAME} INTERFACE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp}) else() target_sources(${TARGET_NAME} PRIVATE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp}) @@ -148,6 +150,6 @@ function(myx_target_setup_qt TARGET_NAME) FILES ${ARG_PUBLIC_MOC} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT DEV - ) + ) endif() endfunction() diff --git a/cmake/myx/lib/Toolchains.cmake b/cmake/myx/lib/Toolchains.cmake index 963098d..9a2b5b3 100644 --- a/cmake/myx/lib/Toolchains.cmake +++ b/cmake/myx/lib/Toolchains.cmake @@ -34,23 +34,38 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - include("${MYX_CMAKE_TOOLCHAINS_DIR}/GCC.cmake") + if(CMAKE_COLOR_MAKEFILE) + check_enable_cxx_compiler_flag(-fdiagnostics-color=auto) + endif() endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - include("${MYX_CMAKE_TOOLCHAINS_DIR}/Clang.cmake") + if(CMAKE_COLOR_MAKEFILE) + check_enable_cxx_compiler_flag(-fcolor-diagnostics) + endif() endif() if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "AstraLinuxSE") AND (MYX_CMAKE_LSB_CODENAME STREQUAL "smolensk") AND (MYX_CMAKE_LSB_RELEASE_VERSION STREQUAL "1.5")) - include("${MYX_CMAKE_TOOLCHAINS_DIR}/AstraLinuxSE-1.5.cmake") - return() + find_program(CMAKE_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7") + find_program(CMAKE_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7") + find_program(CMAKE_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") + + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_EXTENSIONS ON) + check_enable_cxx_compiler_flag(-Wno-shadow) endif() if((MYX_CMAKE_LSB_DISTRIBUTOR_ID STREQUAL "ElbrusD") AND (MYX_CMAKE_LSB_CODENAME STREQUAL "Jessie") AND (MYX_CMAKE_LSB_RELEASE_VERSION VERSION_GREATER "1.4")) - include("${MYX_CMAKE_TOOLCHAINS_DIR}/ElbrusD-1.4.cmake") - return() + find_program(CMAKE_AR NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ar") + find_program(CMAKE_NM NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/nm") + find_program(CMAKE_RANLIB NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ranlib") + + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_EXTENSIONS ON) + check_enable_cxx_compiler_flag(-Wno-invalid-offsetof) + list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu") endif() diff --git a/cmake/myx/lib/doc/Doxygen.cmake b/cmake/myx/lib/doc/Doxygen.cmake index abc3072..0abd9f4 100644 --- a/cmake/myx/lib/doc/Doxygen.cmake +++ b/cmake/myx/lib/doc/Doxygen.cmake @@ -1,11 +1,11 @@ -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17) set(MYX_CMAKE_LIB_DOC_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() find_package(Doxygen QUIET) function(myx_doc_doxygen TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DOC_DIR_BACKPORT}) endif() diff --git a/cmake/myx/lib/generators/GitInfoHeader.cmake b/cmake/myx/lib/generators/GitInfoHeader.cmake index 9fd35a3..029d7a4 100644 --- a/cmake/myx/lib/generators/GitInfoHeader.cmake +++ b/cmake/myx/lib/generators/GitInfoHeader.cmake @@ -17,12 +17,12 @@ myx_generate_git_info_header include_guard(GLOBAL) -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() function(myx_generate_git_info_header TARGET_NAME BASE_FILENAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT}) endif() @@ -31,26 +31,31 @@ function(myx_generate_git_info_header TARGET_NAME BASE_FILENAME) set(multiValueArgs) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(__filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}") - file(APPEND ${__filename} "") + set(filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}") + file(APPEND ${filename} "") - set(__prefix "") + set(prefix "") if(ARG_PREFIX) string(APPEND ARG_PREFIX "_") - string(REPLACE "-" "_" __prefix ${ARG_PREFIX}) + string(REPLACE "-" "_" prefix ${ARG_PREFIX}) endif() # cmake-format: off if(NOT TARGET ${TARGET_NAME}-git-info-header) add_custom_target(${TARGET_NAME}-git-info-header ALL - ${CMAKE_COMMAND} -DGIT_INFO_FILE=${__filename} -DPREFIX=${__prefix} + ${CMAKE_COMMAND} -DGIT_INFO_FILE=${filename} -DPREFIX=${prefix} -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/GitInfo.cmake - BYPRODUCTS ${__filename} + BYPRODUCTS ${filename} WORKING_DIRECTORY ${CMAKE_CURRENT_FUNCTION_LIST_DIR}) endif() # cmake-format: on - set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${__filename}) - target_sources(${TARGET_NAME} PRIVATE ${__filename}) + set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename}) + get_target_property(target_type ${TARGET_NAME} TYPE) + if(${target_type} STREQUAL "INTERFACE_LIBRARY") + target_sources(${TARGET_NAME} INTERFACE $) + else() + target_sources(${TARGET_NAME} PRIVATE ${filename}) + endif() add_dependencies(${TARGET_NAME} ${TARGET_NAME}-git-info-header) endfunction() diff --git a/cmake/myx/lib/generators/PrivateConfigHeader.cmake b/cmake/myx/lib/generators/PrivateConfigHeader.cmake index d4bfdc3..528dd34 100644 --- a/cmake/myx/lib/generators/PrivateConfigHeader.cmake +++ b/cmake/myx/lib/generators/PrivateConfigHeader.cmake @@ -14,12 +14,12 @@ myx_generate_private_config_header include_guard(GLOBAL) -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() function(myx_generate_private_config_header TARGET_NAME BASE_FILENAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_GENERATORS_DIR_BACKPORT}) endif() @@ -27,9 +27,14 @@ function(myx_generate_private_config_header TARGET_NAME BASE_FILENAME) myx_project_version_int() get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT) - set(__filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}") - configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${__filename}) + set(filename "${PROJECT_BINARY_DIR}/include/${BASE_FILENAME}") + configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrivateConfig.hpp.in" ${filename}) - set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${__filename}) - target_sources(${TARGET_NAME} PRIVATE ${__filename}) + set_property(TARGET ${TARGET_NAME} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename}) + get_target_property(target_type ${TARGET_NAME} TYPE) + if(${target_type} STREQUAL "INTERFACE_LIBRARY") + target_sources(${TARGET_NAME} INTERFACE $) + else() + target_sources(${TARGET_NAME} PRIVATE ${filename}) + endif() endfunction() diff --git a/cmake/myx/lib/macro/CheckEnableCxxCompilerFlag.cmake b/cmake/myx/lib/macro/CheckEnableCxxCompilerFlag.cmake index eb24c11..d5d398e 100644 --- a/cmake/myx/lib/macro/CheckEnableCxxCompilerFlag.cmake +++ b/cmake/myx/lib/macro/CheckEnableCxxCompilerFlag.cmake @@ -27,8 +27,8 @@ macro(check_enable_cxx_compiler_flag FLAG) endif() unset(check_cxx_flag CACHE) - foreach(__iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${__iter}) + foreach(iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/cmake/myx/lib/macro/CreateSymlink.cmake b/cmake/myx/lib/macro/CreateSymlink.cmake index 15b7e44..0efd936 100644 --- a/cmake/myx/lib/macro/CreateSymlink.cmake +++ b/cmake/myx/lib/macro/CreateSymlink.cmake @@ -3,7 +3,7 @@ include_guard(GLOBAL) # Создание символических ссылок macro(myx_create_symlink ORIGINAL_FILENAME LINKNAME) if(UNIX AND (NOT EXISTS ${LINKNAME})) - if(${CMAKE_VERSION} VERSION_LESS "3.14.0") + if(${CMAKE_VERSION} VERSION_LESS 3.14.0) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${ORIGINAL_FILENAME} ${LINKNAME}) else() diff --git a/cmake/myx/lib/macro/FindPackages.cmake b/cmake/myx/lib/macro/FindPackages.cmake index b18d17b..d28a187 100644 --- a/cmake/myx/lib/macro/FindPackages.cmake +++ b/cmake/myx/lib/macro/FindPackages.cmake @@ -52,8 +52,8 @@ macro(myx_find_packages) endforeach() endif() - foreach(__iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${__iter}) + foreach(iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/cmake/myx/lib/macro/FindQt.cmake b/cmake/myx/lib/macro/FindQt.cmake index 27a5fb5..7e09d2d 100644 --- a/cmake/myx/lib/macro/FindQt.cmake +++ b/cmake/myx/lib/macro/FindQt.cmake @@ -30,8 +30,8 @@ macro(myx_find_qt) find_package("Qt${ARG_VERSION}${iter}" COMPONENTS Private ${ARG_REQUIRED}) endforeach() - foreach(__iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${__iter}) + foreach(iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/cmake/myx/lib/macro/GTest.cmake b/cmake/myx/lib/macro/GTest.cmake index 9ff6b92..d7b7aae 100644 --- a/cmake/myx/lib/macro/GTest.cmake +++ b/cmake/myx/lib/macro/GTest.cmake @@ -19,8 +19,8 @@ macro(myx_add_gtest TARGET_NAME) endif() add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) - foreach(__iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${__iter}) + foreach(iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/cmake/myx/lib/macro/QTest.cmake b/cmake/myx/lib/macro/QTest.cmake index be0dbb6..2750443 100644 --- a/cmake/myx/lib/macro/QTest.cmake +++ b/cmake/myx/lib/macro/QTest.cmake @@ -14,8 +14,8 @@ macro(myx_add_qtest TARGET_NAME) foreach(filename ${ARG_UNPARSED_ARGUMENTS}) get_filename_component(basename ${filename} NAME_WE) - list(APPEND cpps "${basename}.cpp") - list(APPEND hpps "${basename}.hpp") + list(APPEND cpps "${CMAKE_CURRENT_SOURCE_DIR}/${basename}.cpp") + list(APPEND hpps "${CMAKE_CURRENT_SOURCE_DIR}/${basename}.hpp") qt5_wrap_cpp(moc "${basename}.hpp") list(APPEND mocs "${moc}") endforeach() @@ -29,8 +29,8 @@ macro(myx_add_qtest TARGET_NAME) unset(hpps) unset(moc) unset(mocs) - foreach(__iter IN LISTS oneValueArgs multiValueArgs) - unset(ARG_${__iter}) + foreach(iter IN LISTS oneValueArgs multiValueArgs) + unset(ARG_${iter}) endforeach() unset(ARG_UNPARSED_ARGUMENTS) unset(multiValueArgs) diff --git a/cmake/myx/lib/toolchains/AstraLinuxSE-1.5.cmake b/cmake/myx/lib/toolchains/AstraLinuxSE-1.5.cmake deleted file mode 100644 index df9db4a..0000000 --- a/cmake/myx/lib/toolchains/AstraLinuxSE-1.5.cmake +++ /dev/null @@ -1,8 +0,0 @@ -find_program(CMAKE_AR NAMES "/usr/bin/x86_64-linux-gnu-gcc-ar-4.7") -find_program(CMAKE_NM NAMES "/usr/bin/x86_64-linux-gnu-gcc-nm-4.7") -find_program(CMAKE_RANLIB NAMES "/usr/bin/x86_64-linux-gnu-gcc-ranlib-4.7") - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_EXTENSIONS ON) -check_enable_cxx_compiler_flag(-Wno-shadow) - diff --git a/cmake/myx/lib/toolchains/Clang.cmake b/cmake/myx/lib/toolchains/Clang.cmake deleted file mode 100644 index e5f1d62..0000000 --- a/cmake/myx/lib/toolchains/Clang.cmake +++ /dev/null @@ -1,3 +0,0 @@ -if(CMAKE_COLOR_MAKEFILE) - check_enable_cxx_compiler_flag(-fcolor-diagnostics) -endif() diff --git a/cmake/myx/lib/toolchains/ElbrusD-1.4.cmake b/cmake/myx/lib/toolchains/ElbrusD-1.4.cmake deleted file mode 100644 index 29b46c6..0000000 --- a/cmake/myx/lib/toolchains/ElbrusD-1.4.cmake +++ /dev/null @@ -1,9 +0,0 @@ -find_program(CMAKE_AR NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ar") -find_program(CMAKE_NM NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/nm") -find_program(CMAKE_RANLIB NAMES "/usr/${CMAKE_SYSTEM_PROCESSOR}-linux/bin/ranlib") - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_EXTENSIONS ON) -check_enable_cxx_compiler_flag(-Wno-invalid-offsetof) -list(APPEND CMAKE_LIBRARY_PATH "/usr/lib/e2k-linux-gnu") - diff --git a/cmake/myx/lib/toolchains/GCC.cmake b/cmake/myx/lib/toolchains/GCC.cmake deleted file mode 100644 index 3ac7ec8..0000000 --- a/cmake/myx/lib/toolchains/GCC.cmake +++ /dev/null @@ -1,3 +0,0 @@ -if(CMAKE_COLOR_MAKEFILE) - check_enable_cxx_compiler_flag(-fdiagnostics-color=auto) -endif() diff --git a/cmake/myx/lib/uncrustify/Uncrustify.cmake b/cmake/myx/lib/uncrustify/Uncrustify.cmake index 84efdde..c7b01da 100644 --- a/cmake/myx/lib/uncrustify/Uncrustify.cmake +++ b/cmake/myx/lib/uncrustify/Uncrustify.cmake @@ -1,11 +1,11 @@ -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") +if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}") endif() find_program(UNCRUSTIFY_EXE NAMES uncrustify) function(myx_uncrustify TARGET_NAME) - if(${CMAKE_VERSION} VERSION_LESS "3.17.0") + if(${CMAKE_VERSION} VERSION_LESS 3.17.0) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_UNCRUSTIFY_DIR_BACKPORT}) endif() @@ -45,51 +45,50 @@ function(myx_uncrustify TARGET_NAME) endif() # Динамически сгенерированные файлы исключаются - get_target_property(__target_type ${TARGET_NAME} TYPE) - if((${__target_type} STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS "3.17.0")) - get_target_property(__s1 ${TARGET_NAME} INTERFACE_SOURCES) - if(__s1) - list(APPEND __all_sources ${__s1}) + get_target_property(target_type ${TARGET_NAME} TYPE) + if((${target_type} STREQUAL "INTERFACE_LIBRARY") AND (${CMAKE_VERSION} VERSION_LESS 3.17.0)) + get_target_property(target_sources ${TARGET_NAME} INTERFACE_SOURCES) + if(target_sources) + list(APPEND all_sources ${target_sources}) endif() else() - get_target_property(__s2 ${TARGET_NAME} SOURCES) - if(__s2) - list(APPEND __all_sources ${__s2}) + get_target_property(target_sources ${TARGET_NAME} SOURCES) + if(target_sources) + list(APPEND all_sources ${target_sources}) endif() endif() - foreach(iter ${__all_sources}) + foreach(iter ${all_sources}) string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) if(pos EQUAL -1) - list(APPEND __sources ${iter}) + list(APPEND sources ${iter}) endif() endforeach() - target_sources(${TARGET_NAME} PRIVATE ${ARG_CONFIG}) - set(__fixed_config ${PROJECT_BINARY_DIR}/uncrustify-${TARGET_NAME}.cfg) - add_custom_command(OUTPUT ${__fixed_config} + set(fixed_config ${PROJECT_BINARY_DIR}/uncrustify-${TARGET_NAME}.cfg) + add_custom_command(OUTPUT ${fixed_config} DEPENDS ${ARG_CONFIG} COMMAND ${UNCRUSTIFY_EXE} --update-config-with-doc - -c ${ARG_CONFIG} -o ${__fixed_config}) - list(APPEND __options -c ${__fixed_config}) + -c ${ARG_CONFIG} -o ${fixed_config}) + list(APPEND options -c ${fixed_config}) # cmake-format: off add_custom_target(${TARGET_NAME}-uncrustify-check - DEPENDS ${__fixed_config} - COMMAND ${UNCRUSTIFY_EXE} ${__options} --check ${__sources}) + DEPENDS ${fixed_config} + COMMAND ${UNCRUSTIFY_EXE} ${options} --check ${sources}) - list(APPEND __options --replace --no-backup) + list(APPEND options --replace --no-backup) add_custom_target(${TARGET_NAME}-uncrustify - DEPENDS ${__fixed_config} - COMMAND ${UNCRUSTIFY_EXE} ${__options} --mtime ${__sources}) + DEPENDS ${fixed_config} + COMMAND ${UNCRUSTIFY_EXE} ${options} --mtime ${sources}) add_custom_target(${TARGET_NAME}-uncrustify-append-comments - DEPENDS ${__fixed_config} - COMMAND ${UNCRUSTIFY_EXE} ${__options} + DEPENDS ${fixed_config} + COMMAND ${UNCRUSTIFY_EXE} ${options} --set cmt_insert_class_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/classheader.txt --set cmt_insert_file_footer=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/filefooter.txt --set cmt_insert_file_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/fileheader.txt --set cmt_insert_func_header=${CMAKE_CURRENT_FUNCTION_LIST_DIR}/funcheader.txt - --set cmt_insert_before_ctor_dtor=true --mtime ${__sources}) + --set cmt_insert_before_ctor_dtor=true --mtime ${sources}) # cmake-format: on add_dependencies(myx-uncrustify ${TARGET_NAME}-uncrustify) diff --git a/cmake/myx_setup.cmake b/cmake/myx_setup.cmake index a2155fd..848853d 100644 --- a/cmake/myx_setup.cmake +++ b/cmake/myx_setup.cmake @@ -20,11 +20,11 @@ if(ENV{MYX_CMAKE_DIR}) set(MYX_CMAKE_DIR $ENV{MYX_CMAKE_DIR}) endif() if(MYX_CMAKE_DIR) - find_package(MyxCMake 2.4.12 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.4.33 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) myx_message_notice("== MyxCMake directory: ${MyxCMake_CONFIG} ==") else() if(MYX_CMAKE_USE_SYSTEM) - find_package(MyxCMake 2.4.12 REQUIRED) + find_package(MyxCMake 2.4.33 REQUIRED) myx_message_notice("== MyxCMake directory: ${MyxCMake_CONFIG} ==") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)