mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-21 23:00:50 +08:00
QtDialog: use Qt5's imported targets
This commit is contained in:
@@ -4,19 +4,15 @@
|
|||||||
project(QtDialog)
|
project(QtDialog)
|
||||||
CMake_OPTIONAL_COMPONENT(cmake-gui)
|
CMake_OPTIONAL_COMPONENT(cmake-gui)
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
|
||||||
add_definitions(${Qt5Widgets_DEFINITONS})
|
|
||||||
|
|
||||||
set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
|
set(CMake_QT_EXTRA_LIBRARIES)
|
||||||
set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES})
|
|
||||||
|
|
||||||
# Try to find the package WinExtras for the task bar progress
|
# Try to find the package WinExtras for the task bar progress
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
find_package(Qt5WinExtras QUIET)
|
find_package(Qt5WinExtras QUIET)
|
||||||
if (Qt5WinExtras_FOUND)
|
if (Qt5WinExtras_FOUND)
|
||||||
include_directories(${Qt5WinExtras_INCLUDE_DIRS})
|
|
||||||
add_definitions(-DQT_WINEXTRAS)
|
add_definitions(-DQT_WINEXTRAS)
|
||||||
list(APPEND CMake_QT_LIBRARIES ${Qt5WinExtras_LIBRARIES})
|
list(APPEND CMake_QT_EXTRA_LIBRARIES Qt5::WinExtras)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -26,13 +22,13 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||||
|
|
||||||
if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES)
|
if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES)
|
||||||
list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES})
|
list(APPEND CMake_QT_EXTRA_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES})
|
||||||
set_property(SOURCE CMakeSetup.cxx
|
set_property(SOURCE CMakeSetup.cxx
|
||||||
PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin)
|
PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
|
if(CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
|
||||||
list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES})
|
list(APPEND CMake_QT_EXTRA_LIBRARIES ${CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES})
|
||||||
set_property(SOURCE CMakeSetup.cxx
|
set_property(SOURCE CMakeSetup.cxx
|
||||||
PROPERTY COMPILE_DEFINITIONS USE_QWindowsIntegrationPlugin)
|
PROPERTY COMPILE_DEFINITIONS USE_QWindowsIntegrationPlugin)
|
||||||
endif()
|
endif()
|
||||||
@@ -79,13 +75,11 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TARGET Qt5::Core)
|
|
||||||
get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION)
|
get_property(_Qt5_Core_LOCATION TARGET Qt5::Core PROPERTY LOCATION)
|
||||||
get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH)
|
get_filename_component(Qt_BIN_DIR "${_Qt5_Core_LOCATION}" PATH)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
|
get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
AddCacheEntry.cxx
|
AddCacheEntry.cxx
|
||||||
@@ -160,7 +154,7 @@ endif()
|
|||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
|
add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
|
||||||
target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES})
|
target_link_libraries(cmake-gui CMakeLib Qt5::Core Qt5::Widgets ${CMake_QT_EXTRA_LIBRARIES})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(cmake-gui PRIVATE $<TARGET_OBJECTS:CMakeVersion>)
|
target_sources(cmake-gui PRIVATE $<TARGET_OBJECTS:CMakeVersion>)
|
||||||
|
Reference in New Issue
Block a user