From f6107e5bff6f2fa506eeeab15d7220476ff36d3d Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Fri, 7 Oct 2022 00:03:48 +0300 Subject: [PATCH] 2.0.3 --- MyxCMake/MyxCMakeConfigVersion.cmake | 2 +- MyxCMake/lib/TargetSetup.cmake | 37 +++++++++++++++++++++++++--- README.md | 2 +- VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- myx_setup.cmake | 4 +-- 7 files changed, 41 insertions(+), 10 deletions(-) diff --git a/MyxCMake/MyxCMakeConfigVersion.cmake b/MyxCMake/MyxCMakeConfigVersion.cmake index ac67288..38b71d2 100644 --- a/MyxCMake/MyxCMakeConfigVersion.cmake +++ b/MyxCMake/MyxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYX_CMAKE_PACKAGE_VERSION "2.0.2") +set(MYX_CMAKE_PACKAGE_VERSION "2.0.3") if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxCMake/lib/TargetSetup.cmake b/MyxCMake/lib/TargetSetup.cmake index cb2236f..cd79431 100644 --- a/MyxCMake/lib/TargetSetup.cmake +++ b/MyxCMake/lib/TargetSetup.cmake @@ -73,11 +73,42 @@ 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}) - if(NOT target_type STREQUAL "OBJECT_LIBRARY") - target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES}) - endif() target_compile_definitions(${NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS}) + # CMake до версии 3.12 не умеет извлекать из целей типа `OBJECT_LIBRARY` + # информацию о заголовочных файлах. Это обход. + if(${CMAKE_VERSION} VERSION_GREATER "3.11.99") + target_link_libraries(${NAME} PRIVATE ${ARG_LINK_LIBRARIES}) + else() + if((NOT ${target_type} STREQUAL "OBJECT_LIBRARY") AND + (NOT ${target_type} STREQUAL "EXECUTABLE")) + target_link_libraries(${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_dir ${link_library} INTERFACE_INCLUDE_DIRECTORIES) + if(include_dir) + target_include_directories(${NAME} PUBLIC ${include_dir}) + endif() + if(${target_type} STREQUAL "EXECUTABLE") + if(${lib_type} STREQUAL "OBJECT_LIBRARY") + if(TARGET ${link_library}_static) + target_link_libraries(${NAME} PRIVATE ${link_library}_static) + else() + target_link_libraries(${NAME} PRIVATE ${link_library}_shared) + endif() + else() + target_link_libraries(${NAME} PRIVATE ${link_library}) + endif() + endif() + endif() + endif() + endforeach() + endif() + endif() + # Установка публичных заголовочных файлов if(PROJECT_IS_TOP_LEVEL) install_relative(${PROJECT_SOURCE_DIR} diff --git a/README.md b/README.md index 4ecb8fe..3afd056 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Установка В корневом каталоге проекта создать каталог `cmake` и распаковать в него -[архив](../../../releases/download/2.0.2/myx-cmake-local-2.0.2.tar.xz ). +[архив](../../../releases/download/2.0.3/myx-cmake-local-2.0.3.tar.xz ). ## Использование diff --git a/VERSION b/VERSION index e9307ca..50ffc5a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.2 +2.0.3 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index ad83203..87f1c0a 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6 FATAL_ERROR) -project(myx-cmake VERSION 2.0.2 LANGUAGES) +project(myx-cmake VERSION 2.0.3 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index 389ca4e..b3ba04a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myx-cmake (2.0.2) unstable; urgency=medium +myx-cmake (2.0.3) unstable; urgency=medium * New version. diff --git a/myx_setup.cmake b/myx_setup.cmake index 31cef76..609b998 100644 --- a/myx_setup.cmake +++ b/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.0.2 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH) + find_package(MyxCMake 2.0.3 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.0.2 REQUIRED) + find_package(MyxCMake 2.0.3 REQUIRED) myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===") else() include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)