diff --git a/MyxCMakeConfig.cmake b/MyxCMakeConfig.cmake index 91aad77..9b02894 100644 --- a/MyxCMakeConfig.cmake +++ b/MyxCMakeConfig.cmake @@ -6,8 +6,8 @@ list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/find") get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) -set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports") -set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib") +set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports" CACHE PATH "") +set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib" CACHE PATH "") include(${MYX_CMAKE_BACKPORTS_DIR}/IncludeGuard.cmake) include(${MYX_CMAKE_BACKPORTS_DIR}/TopLevelProject.cmake) diff --git a/MyxCMakeConfigVersion.cmake b/MyxCMakeConfigVersion.cmake index b326d75..ee612a6 100644 --- a/MyxCMakeConfigVersion.cmake +++ b/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "1.99.85") +set(MYX_CMAKE_PACKAGE_VERSION "1.99.86") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/README.md b/README.md index 9d8451c..5d023be 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,10 @@ if(MYX_CMAKE_DIR) set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR}) endif() if(DEFINED ENV{MYX_CMAKE_DIR}) - find_package(MyxCMake 1.99.85 REQUIRED) + find_package(MyxCMake 1.99.86 REQUIRED) else() if(MYX_CMAKE_USE_SYSTEM) - find_package(MyxCMake 1.99.85 REQUIRED) + find_package(MyxCMake 1.99.86 REQUIRED) else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake) endif() diff --git a/VERSION b/VERSION index da4e585..36a0d1d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.99.85 +1.99.86 diff --git a/backports/TopLevelProject.cmake b/backports/TopLevelProject.cmake index b1b89ee..86994cc 100644 --- a/backports/TopLevelProject.cmake +++ b/backports/TopLevelProject.cmake @@ -1,6 +1,6 @@ include_guard(GLOBAL) -if(CMAKE_VERSION VERSION_LESS 3.21) +if(${CMAKE_VERSION} VERSION_LESS 3.21) get_property(nt DIRECTORY PROPERTY PARENT_DIRECTORY) if(NOT nt) set(PROJECT_IS_TOP_LEVEL true) diff --git a/lib/AddLibrary.cmake b/lib/AddLibrary.cmake index df0c197..2d3688c 100644 --- a/lib/AddLibrary.cmake +++ b/lib/AddLibrary.cmake @@ -19,12 +19,6 @@ myx_add_library include_guard(GLOBAL) -# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет определить -# каталог файла. -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) -endif() - include(CMakePackageConfigHelpers) include(GenerateExportHeader) @@ -142,7 +136,7 @@ function(myx_add_library NAME TYPE) ) configure_package_config_file( - ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/library-config.cmake.in + ${MYX_CMAKE_LIB_DIR}/library-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAME} NO_SET_AND_CHECK_MACRO diff --git a/lib/TargetSetup.cmake b/lib/TargetSetup.cmake index dc1e3e0..cb2236f 100644 --- a/lib/TargetSetup.cmake +++ b/lib/TargetSetup.cmake @@ -36,7 +36,7 @@ function(myx_target_setup NAME) endif() if(ARG_PCH) - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16 AND PROJECT_IS_TOP_LEVEL OR MYX_USE_LOCAL_DIRECTORIES) + if((${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16) AND (PROJECT_IS_TOP_LEVEL OR MYX_USE_LOCAL_DIRECTORIES)) target_precompile_headers(${NAME} PRIVATE ${ARG_PCH}) else() target_compile_options(${NAME} PRIVATE -include ${ARG_PCH}) @@ -73,7 +73,9 @@ function(myx_target_setup NAME) target_sources(${NAME} PUBLIC $) target_sources(${NAME} PUBLIC ${ARG_PUBLIC_HEADERS}) target_sources(${NAME} PRIVATE ${ARG_CPP} ${ARG_PCH} ${ARG_PRIVATE_HEADERS}) - target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES}) + if(NOT target_type STREQUAL "OBJECT_LIBRARY") + target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES}) + endif() target_compile_definitions(${NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS}) # Установка публичных заголовочных файлов diff --git a/lib/Uncrustify.cmake b/lib/Uncrustify.cmake index 620e38f..e3b1085 100644 --- a/lib/Uncrustify.cmake +++ b/lib/Uncrustify.cmake @@ -52,12 +52,12 @@ function(myx_uncrustify target) endif() if(NOT EXISTS ${ARG_CONFIG}) - myx_message_notify("MyxCMake: uncrustify config is not found") + myx_message_notice("MyxCMake: uncrustify config is not found") return() endif() if(NOT UNCRUSTIFY_EXE) - myx_message_notify("MyxCMake: uncrustify executable is not found") + myx_message_notice("MyxCMake: uncrustify executable is not found") return() endif() diff --git a/lib/doc/Doxygen.cmake b/lib/doc/Doxygen.cmake index 794335e..7d1264e 100644 --- a/lib/doc/Doxygen.cmake +++ b/lib/doc/Doxygen.cmake @@ -1,11 +1,5 @@ include_guard(GLOBAL) -# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет определить -# каталог файла. -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) -endif() - function(myx_doc_doxygen NAME) find_package(Doxygen) if(DOXYGEN_FOUND) @@ -45,7 +39,7 @@ function(myx_doc_doxygen NAME) set(ARG_LANGUAGE "Russian") endif() if(NOT ARG_DOXYFILE_TEMPLATE OR NOT EXISTS "${ARG_DOXYFILE_TEMPLATE}") - set(ARG_DOXYFILE_TEMPLATE "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Doxyfile.in") + set(ARG_DOXYFILE_TEMPLATE "${MYX_CMAKE_LIB_DIR}/doc/Doxyfile.in") endif() if(NOT DOXYGEN_PROJECT_NAME) set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME}) diff --git a/lib/generators/GitInfo.cmake b/lib/generators/GitInfo.cmake index df10bfa..5b9f2a7 100644 --- a/lib/generators/GitInfo.cmake +++ b/lib/generators/GitInfo.cmake @@ -1,11 +1,6 @@ cmake_policy(PUSH) cmake_policy(SET CMP0053 NEW) # IN_LIST operator -# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет определить каталог файла. -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) -endif() - set(ARG_PREFIX "${PREFIX}") set(GIT_REV "N/A") set(GIT_DIFF "") diff --git a/lib/generators/GitInfoHeader.cmake b/lib/generators/GitInfoHeader.cmake index 506af68..5798020 100644 --- a/lib/generators/GitInfoHeader.cmake +++ b/lib/generators/GitInfoHeader.cmake @@ -16,12 +16,6 @@ myx_generate_git_info_header include_guard(GLOBAL) -# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет -# определить каталог файла. -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) -endif() - function(myx_generate_git_info_header target base_filename) set(options) set(oneValueArgs PREFIX) @@ -41,9 +35,9 @@ function(myx_generate_git_info_header target base_filename) if(NOT TARGET ${target}-git-info-header) add_custom_target(${target}-git-info-header ALL ${CMAKE_COMMAND} -DGIT_INFO_FILE=${filename} -DPREFIX=${PREFIX} - -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/GitInfo.cmake + -P ${MYX_CMAKE_LIB_DIR}/generators/GitInfo.cmake BYPRODUCTS ${filename} - WORKING_DIRECTORY ${CMAKE_CURRENT_FUNCTION_LIST_DIR}) + WORKING_DIRECTORY ${MYX_CMAKE_LIB_DIR}/generators) endif() # cmake-format: on diff --git a/lib/generators/PrivateConfigHeader.cmake b/lib/generators/PrivateConfigHeader.cmake index b91ba09..523ccb8 100644 --- a/lib/generators/PrivateConfigHeader.cmake +++ b/lib/generators/PrivateConfigHeader.cmake @@ -14,19 +14,13 @@ myx_generate_private_config_header include_guard(GLOBAL) -# Переменная `CMAKE_CURRENT_FUNCTION_LIST_DIR` позволяет определить -# каталог файла. -if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) -endif() - function(myx_generate_private_config_header target base_filename) set(BUILD_DATE ${MYX_TODAY}) 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}) + configure_file("${MYX_CMAKE_LIB_DIR}/generators/PrivateConfig.hpp.in" ${filename}) set_property(TARGET ${target} APPEND PROPERTY PRIVATE_HEADER_FILES ${filename}) target_sources(${target} PRIVATE ${filename})