This commit is contained in:
Andrei Astafev 2022-10-04 08:08:30 +03:00
parent 386faf578e
commit 45ca72b363
5 changed files with 25 additions and 14 deletions

View File

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

View File

@ -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.71 REQUIRED)
find_package(MyxCMake 1.99.72 REQUIRED)
else()
if(MYX_CMAKE_USE_SYSTEM)
find_package(MyxCMake 1.99.71 REQUIRED)
find_package(MyxCMake 1.99.72 REQUIRED)
else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
endif()

View File

@ -1 +1 @@
1.99.71
1.99.72

View File

@ -10,14 +10,22 @@ function(myx_qt5_target_setup NAME)
get_target_property(type ${NAME} TYPE)
foreach(iter ${ARG_COMPONENTS})
target_include_directories(${NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS})
if(type STREQUAL "INTERFACE_LIBRARY")
target_include_directories(${NAME} INTERFACE ${Qt5${iter}_INCLUDE_DIRS})
else()
target_include_directories(${NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS})
endif()
if(type STREQUAL "EXECUTABLE" AND NOT iter STREQUAL "LinguistTools")
target_link_libraries(${NAME} PRIVATE "Qt5::${iter}")
endif()
endforeach()
foreach(iter ${ARG_PRIVATE})
target_include_directories(${NAME} PRIVATE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
if(type STREQUAL "INTERFACE_LIBRARY")
target_include_directories(${NAME} INTERFACE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
else()
target_include_directories(${NAME} PRIVATE ${Qt5${iter}_PRIVATE_INCLUDE_DIRS})
endif()
endforeach()
if(type STREQUAL "EXECUTABLE")

View File

@ -4,7 +4,7 @@ function(myx_target_setup NAME)
set(options)
set(oneValueArgs PCH)
set(multiValueArgs COMPILE_DEFINITIONS PACKAGES LINK_LIBRARIES
CPP PUBLIC_HEADERS PRIVATE_HEADERS)
CPP INTERFACE_HEADERS PUBLIC_HEADERS PRIVATE_HEADERS)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@ -48,15 +48,17 @@ function(myx_target_setup NAME)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include")
endif()
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/src")
if(NOT type STREQUAL "INTERFACE_LIBRARY")
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/src")
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
endif()
endif()
if(type STREQUAL EXECUTABLE)
if(type STREQUAL "EXECUTABLE")
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/include")
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
@ -72,6 +74,7 @@ function(myx_target_setup NAME)
install(TARGETS ${NAME} COMPONENT main RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
target_sources(${NAME} INTERFACE $<BUILD_INTERFACE:${ARG_INTERFACE_HEADERS}>)
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})
@ -80,7 +83,7 @@ function(myx_target_setup NAME)
# Установка публичных заголовочных файлов
if(PROJECT_IS_TOP_LEVEL)
install_relative(${PROJECT_SOURCE_DIR}
FILES ${ARG_PUBLIC_HEADERS}
FILES ${ARG_PUBLIC_HEADERS} ${ARG_INTERFACE_HEADERS}
DESTINATION ${CMAKE_INSTALL_PREFIX}
COMPONENT dev
)