Обновление MyxCMake

This commit is contained in:
Andrei Astafev 2022-10-04 13:26:23 +03:00
parent da91c97551
commit b311425c77
4 changed files with 12 additions and 8 deletions

View File

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

View File

@ -57,12 +57,12 @@ function(myx_qt5_target_setup NAME)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_BINARY_DIR})
endif()
# Перечень файлов, подлежащих переводу
get_target_property(tr ${NAME} TR_FILES)
# Формирование файла ресурсов с переводами
if("LinguistTools" IN_LIST ARG_COMPONENTS)
if("LinguistTools" IN_LIST ARG_COMPONENTS AND tr)
# Заглавие файла ресурсов
file(WRITE ${PROJECT_BINARY_DIR}/${NAME}_l10n.qrc "<RCC><qresource prefix=\"/qm\">\n")
# Перечень файлов, подлежащих переводу
get_target_property(tr ${NAME} TR_FILES)
# Для каждого языка, указанное в параметре LANGS
foreach(iter ${ARG_LANGS})
# Создание или обновление файла переводов в каталоге ${PROJECT_SOURCE_DIR}/l10n
@ -80,6 +80,7 @@ function(myx_qt5_target_setup NAME)
qt5_add_resources(qrc_l10n ${PROJECT_BINARY_DIR}/${NAME}_l10n.qrc)
target_sources(${NAME} PRIVATE ${qrc_l10n})
endif()
unset(tr)
target_sources(${NAME} PRIVATE ${ARG_PUBLIC_MOC} ${ARG_PRIVATE_MOC} ${moc_cpp} ${ui_h} ${qrc_cpp})
# Установка публичных заголовочных файлов

View File

@ -36,7 +36,7 @@ function(myx_target_setup NAME)
endif()
if(ARG_PCH)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
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})
@ -74,7 +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 $<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})

View File

@ -16,12 +16,15 @@ if(MYX_CMAKE_DIR)
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
endif()
if(DEFINED ENV{MYX_CMAKE_DIR})
find_package(MyxCMake 1.99.73 CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH REQUIRED)
find_package(MyxCMake 1.99.75 CONFIG PATHS $ENV{MYX_CMAKE_DIR} NO_DEFAULT_PATH REQUIRED)
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
else()
if(MYX_CMAKE_USE_SYSTEM)
find_package(MyxCMake 1.99.73 REQUIRED)
find_package(MyxCMake 1.99.75 REQUIRED)
myx_message_notice("=== MyxCMake directory: ${MyxCMake_CONFIG} ===")
else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
myx_message_notice("=== MyxCMake directory: ${PROJECT_SOURCE_DIR}/cmake/myx ===")
endif()
endif()