From 03832447bf8eaef06ec00155dc6d1465fdcb917a Mon Sep 17 00:00:00 2001 From: Andrei Astafev Date: Tue, 1 Aug 2023 12:03:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyxCMake/lib/TargetSetupQt.cmake | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/MyxCMake/lib/TargetSetupQt.cmake b/MyxCMake/lib/TargetSetupQt.cmake index 22a46d4..2bf6215 100644 --- a/MyxCMake/lib/TargetSetupQt.cmake +++ b/MyxCMake/lib/TargetSetupQt.cmake @@ -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()