This commit is contained in:
Andrei Astafev 2022-09-29 14:57:54 +03:00
parent 9cf95c0859
commit 1728ffb56d
4 changed files with 28 additions and 2 deletions

View File

@ -1,4 +1,4 @@
set(MYX_CMAKE_PACKAGE_VERSION "1.99.5")
set(MYX_CMAKE_PACKAGE_VERSION "1.99.6")
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

View File

@ -11,6 +11,6 @@
`project` добавить строку:
```cmake
find_package(MyxCMake 1.99.5 PATHS cmake/myx NO_DEFAULT_PATH QUIET REQUIRED)
find_package(MyxCMake 1.99.6 PATHS cmake/myx NO_DEFAULT_PATH QUIET REQUIRED)
```

View File

@ -12,6 +12,12 @@ function(myx_add_library)
set(arg_TYPE "OBJECT")
endif()
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
# Опция для разрешения сборки разделяемой библиотеки
option(${PROJECT_NAME_UPPER}_BUILD_SHARED "Build shared library" ON)
# Опция для разрешения сборки статической библиотеки
option(${PROJECT_NAME_UPPER}_BUILD_STATIC "Build static library" ON)
add_library(${PROJECT_NAME} ${arg_TYPE})
if(arg_TYPE STREQUAL INTERFACE)

View File

@ -44,4 +44,24 @@ function(myx_install_library)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT dev
)
if(TARGET ${PROJECT_NAME}_shared)
install(
TARGETS ${PROJECT_NAME}_shared
EXPORT ${PROJECT_NAME}Target
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib
)
endif()
if(TARGET ${PROJECT_NAME}_static)
install(
TARGETS ${PROJECT_NAME}_static
EXPORT ${PROJECT_NAME}Target
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib
)
endif()
endfunction()