Вызовы функции find_package
вынесены из функций
This commit is contained in:
parent
ed531c24dd
commit
45cbff6f67
@ -61,7 +61,7 @@ include(${MYX_CMAKE_LIB_DIR}/AddExecutable.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/AddInterfaceLibrary.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/AddObjectLibrary.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/TargetSetup.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/QtTargetSetup.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/macro/QtTargetSetup.cmake)
|
||||
|
||||
include(${MYX_CMAKE_LIB_DIR}/uncrustify/Uncrustify.cmake)
|
||||
include(${MYX_CMAKE_LIB_DIR}/doc/Doxygen.cmake)
|
||||
|
@ -1,4 +1,4 @@
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.3.8")
|
||||
set(MYX_CMAKE_PACKAGE_VERSION "2.4.1")
|
||||
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
@ -2,6 +2,8 @@ if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(MYX_CMAKE_LIB_DOC_DIR_BACKPORT "${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
||||
find_package(Doxygen)
|
||||
|
||||
function(myx_doc_doxygen TARGET_NAME)
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYX_CMAKE_LIB_DOC_DIR_BACKPORT})
|
||||
@ -11,7 +13,6 @@ function(myx_doc_doxygen TARGET_NAME)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
set(DOXYGEN_FOUND ON CACHE STRING "Doxygen documentation generator enabled" FORCE)
|
||||
set(DOXYGEN_EXECUTABLE "${DOXYGEN_EXECUTABLE}" CACHE STRING "Path to Doxygen executable")
|
||||
|
@ -1,6 +1,40 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
function(myx_qt_target_setup TARGET_NAME)
|
||||
macro(myx_qt_target_setup TARGET_NAME)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs COMPONENTS PRIVATE)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT ARG_VERSION)
|
||||
set(ARG_VERSION "5")
|
||||
endif()
|
||||
|
||||
if(NOT (ARG_VERSION STREQUAL "5" OR ARG_VERSION STREQUAL "6"))
|
||||
myx_message_fatal_error("Supported Qt versions are 5 and 6")
|
||||
endif()
|
||||
|
||||
foreach(iter ${ARG_COMPONENTS})
|
||||
find_package(Qt${ARG_VERSION} COMPONENTS ${iter} REQUIRED)
|
||||
endforeach()
|
||||
|
||||
foreach(iter ${ARG_PRIVATE})
|
||||
find_package("Qt${ARG_VERSION}${iter}" COMPONENTS Private REQUIRED)
|
||||
endforeach()
|
||||
|
||||
myx_qt_target_setup_post(${ARGV})
|
||||
|
||||
foreach(__iter IN LISTS oneValueArgs multiValueArgs)
|
||||
unset(ARG_${__iter})
|
||||
endforeach()
|
||||
unset(ARG_UNPARSED_ARGUMENTS)
|
||||
unset(multiValueArgs)
|
||||
unset(oneValueArgs)
|
||||
unset(options)
|
||||
endmacro()
|
||||
|
||||
function(myx_qt_target_setup_post TARGET_NAME)
|
||||
set(options)
|
||||
set(oneValueArgs VERSION)
|
||||
set(multiValueArgs COMPONENTS PRIVATE PUBLIC_MOC PRIVATE_MOC UI QRC LANGS)
|
||||
@ -18,7 +52,6 @@ function(myx_qt_target_setup TARGET_NAME)
|
||||
get_target_property(__target_type ${TARGET_NAME} TYPE)
|
||||
|
||||
foreach(iter ${ARG_COMPONENTS})
|
||||
find_package(Qt${ARG_VERSION} COMPONENTS ${iter} REQUIRED)
|
||||
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
target_include_directories(${TARGET_NAME} INTERFACE ${Qt${ARG_VERSION}${iter}_INCLUDE_DIRS})
|
||||
else()
|
||||
@ -38,7 +71,6 @@ function(myx_qt_target_setup TARGET_NAME)
|
||||
endforeach()
|
||||
|
||||
foreach(iter ${ARG_PRIVATE})
|
||||
find_package("Qt${ARG_VERSION}${iter}" COMPONENTS Private REQUIRED)
|
||||
if(__target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
target_include_directories(${TARGET_NAME} INTERFACE ${Qt${ARG_VERSION}${iter}_PRIVATE_INCLUDE_DIRS})
|
||||
else()
|
@ -3,7 +3,7 @@
|
||||
## Установка
|
||||
|
||||
В корневом каталоге проекта создать каталог `cmake` и распаковать в него
|
||||
[архив](../../../releases/download/2.3.8/myx-cmake-local-2.3.8.tar.xz ).
|
||||
[архив](../../../releases/download/2.4.1/myx-cmake-local-2.4.1.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.3.8 LANGUAGES)
|
||||
project(myx-cmake VERSION 2.4.1 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.3.8) unstable; urgency=medium
|
||||
myx-cmake (2.4.1) 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.3.8 REQUIRED CONFIG PATHS ${MYX_CMAKE_DIR} NO_DEFAULT_PATH)
|
||||
find_package(MyxCMake 2.4.1 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.3.8 REQUIRED)
|
||||
find_package(MyxCMake 2.4.1 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