This commit is contained in:
Andrei Astafev 2022-10-07 00:03:48 +03:00
parent 15b168d689
commit f6107e5bff
7 changed files with 41 additions and 10 deletions

View File

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

View File

@ -73,11 +73,42 @@ function(myx_target_setup NAME)
target_sources(${NAME} PUBLIC $<BUILD_INTERFACE:${ARG_INTERFACE_HEADERS}>)
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}

View File

@ -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 ).
## Использование

View File

@ -1 +1 @@
2.0.2
2.0.3

View File

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

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
myx-cmake (2.0.2) unstable; urgency=medium
myx-cmake (2.0.3) unstable; urgency=medium
* New version.

View File

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