Compare commits
4 Commits
1957cbdb5c
...
03832447bf
Author | SHA1 | Date | |
---|---|---|---|
03832447bf | |||
b1f6805c5e | |||
f22913db9d | |||
0c9573d005 |
@ -1,4 +1,4 @@
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.4.8")
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.4.9")
|
||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
@ -61,8 +61,13 @@ function(myx_download_content NAME)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} fetch
|
||||
WORKING_DIRECTORY ${ARG_DOWNLOAD_DIR}/${NAME})
|
||||
endif()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ARG_GIT_TAG}
|
||||
WORKING_DIRECTORY ${ARG_DOWNLOAD_DIR}/${NAME})
|
||||
if(ARG_GIT_TAG)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ARG_GIT_TAG}
|
||||
WORKING_DIRECTORY ${ARG_DOWNLOAD_DIR}/${NAME})
|
||||
else()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} pull
|
||||
WORKING_DIRECTORY ${ARG_DOWNLOAD_DIR}/${NAME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
|
@ -2,6 +2,7 @@ include_guard(GLOBAL)
|
||||
|
||||
function(myx_target_setup_qt TARGET_NAME)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs COMPONENTS PRIVATE PUBLIC_MOC PRIVATE_MOC UI QRC LANGS)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
@ -18,15 +19,20 @@ function(myx_target_setup_qt TARGET_NAME)
|
||||
get_target_property(__target_type ${TARGET_NAME} TYPE)
|
||||
|
||||
foreach(iter ${ARG_COMPONENTS})
|
||||
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
target_include_directories(${TARGET_NAME} INTERFACE ${Qt5${iter}_INCLUDE_DIRS})
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${Qt5${iter}_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(NOT iter STREQUAL "LinguistTools")
|
||||
if(__target_type STREQUAL "EXECUTABLE")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE "Qt${myx_qt_ver}::${iter}")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE Qt${myx_qt_ver}::${iter})
|
||||
endif()
|
||||
if(__target_type STREQUAL "SHARED_LIBRARY")
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC "Qt${myx_qt_ver}::${iter}")
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter})
|
||||
endif()
|
||||
if((${CMAKE_VERSION} VERSION_GREATER "3.8.0") AND (__target_type STREQUAL "OBJECT_LIBRARY"))
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC "Qt${myx_qt_ver}:${iter}")
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC Qt${myx_qt_ver}::${iter})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@ -70,7 +76,7 @@ function(myx_target_setup_qt TARGET_NAME)
|
||||
endif()
|
||||
|
||||
if(ARG_UI)
|
||||
if(NOT COMMAND qt${myx_ver_qt}qt_wrap_ui)
|
||||
if(NOT COMMAND qt${myx_ver_qt}_wrap_ui)
|
||||
message(WARNING "MyxCMake: Widgets is required to process UI")
|
||||
else()
|
||||
if(myx_qt_ver EQUAL 5)
|
||||
@ -80,6 +86,8 @@ function(myx_target_setup_qt TARGET_NAME)
|
||||
endif()
|
||||
set_property(TARGET ${TARGET_NAME} APPEND PROPERTY TR_FILES ${ARG_UI})
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE Qt${myx_qt_ver}::Widgets)
|
||||
# TODO
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,34 +1,35 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
macro(myx_find_qt)
|
||||
set(options)
|
||||
set(options REQUIRED)
|
||||
set(oneValueArgs VERSION)
|
||||
set(multiValueArgs COMPONENTS PRIVATE)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(ARG_VERSION)
|
||||
set(myx_qt_ver "${ARG_VERSION}")
|
||||
else()
|
||||
set(myx_qt_ver "5")
|
||||
if(NOT ARG_VERSION)
|
||||
set(ARG_VERSION "5")
|
||||
if(QT_DEFAULT_MAJOR_VERSION)
|
||||
set(myx_qt_ver "${QT_DEFAULT_MAJOR_VERSION}")
|
||||
set(ARG_VERSION "${QT_DEFAULT_MAJOR_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT (myx_qt_ver STREQUAL "5" OR myx_qt_ver STREQUAL "6"))
|
||||
myx_message_fatal_error("Supported Qt versions are 5 and 6")
|
||||
if(ARG_REQUIRED)
|
||||
set(ARG_REQUIRED "REQUIRED")
|
||||
endif()
|
||||
|
||||
if(NOT (ARG_VERSION STREQUAL "5" OR ARG_VERSION STREQUAL "6"))
|
||||
message(FATAL_ERROR "Supported Qt versions are 5 and 6")
|
||||
endif()
|
||||
|
||||
foreach(iter ${ARG_COMPONENTS})
|
||||
find_package(Qt${myx_qt_ver} COMPONENTS ${iter} REQUIRED)
|
||||
find_package(Qt${ARG_VERSION} COMPONENTS ${iter} ${ARG_REQUIRED})
|
||||
endforeach()
|
||||
|
||||
foreach(iter ${ARG_PRIVATE})
|
||||
find_package("Qt${myx_qt_ver}${iter}" COMPONENTS Private REQUIRED)
|
||||
find_package("Qt${ARG_VERSION}${iter}" COMPONENTS Private ${ARG_REQUIRED})
|
||||
endforeach()
|
||||
|
||||
unset(myx_qt_ver)
|
||||
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
|
||||
unset(ARG_${__iter})
|
||||
endforeach()
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Установка
|
||||
|
||||
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
||||
[архив](../../../releases/download/2.4.8/myx-cmake-local-2.4.8.tar.xz ).
|
||||
[архив](../../../releases/download/2.4.9/myx-cmake-local-2.4.9.tar.xz ).
|
||||
|
||||
## Использование
|
||||
|
||||
|
2
debian/CMakeLists.txt
vendored
2
debian/CMakeLists.txt
vendored
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
|
||||
project(myx-cmake VERSION 2.4.8 LANGUAGES)
|
||||
project(myx-cmake VERSION 2.4.9 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
myx-cmake (2.4.8) unstable; urgency=medium
|
||||
myx-cmake (2.4.9) unstable; urgency=medium
|
||||
|
||||
* New version.
|
||||
|
||||
|
@ -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.4.8 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
find_package(MyxCMake 2.4.9 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.4.8 REQUIRED)
|
||||
find_package(MyxCMake 2.4.9 REQUIRED)
|
||||
myx_message_notice("== MyxCMake directory: ${MyxCMake_CONFIG} ==")
|
||||
else()
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
|
||||
|
Loading…
Reference in New Issue
Block a user