From e254a3f0c237634d8f1d329b74be67569c2c805a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 12 Jan 2017 23:45:39 -0800 Subject: Search for and use Qt5 for alsoft-config An option is provided to instead use Qt4.8 still if desired. --- utils/alsoft-config/CMakeLists.txt | 49 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'utils/alsoft-config') diff --git a/utils/alsoft-config/CMakeLists.txt b/utils/alsoft-config/CMakeLists.txt index 37fd7ba5..4911b9d8 100644 --- a/utils/alsoft-config/CMakeLists.txt +++ b/utils/alsoft-config/CMakeLists.txt @@ -1,24 +1,23 @@ project(alsoft-config) -include_directories("${alsoft-config_BINARY_DIR}") +option(ALSOFT_NO_QT5 "Use Qt4 instead of Qt5 for alsoft-config" FALSE) -# Need Qt 4.8.0 or newer for the iconset theme attribute to work -find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui) -if(QT4_FOUND) - include(${QT_USE_FILE}) +include_directories("${alsoft-config_BINARY_DIR}") - set(alsoft-config_SRCS main.cpp - mainwindow.cpp - ) +set(alsoft-config_SRCS main.cpp + mainwindow.cpp +) +set(alsoft-config_UIS mainwindow.ui) +set(alsoft-config_MOCS mainwindow.h) - set(alsoft-config_UIS mainwindow.ui) - QT4_WRAP_UI(UIS ${alsoft-config_UIS}) +find_package(Qt5Widgets) +if(Qt5Widgets_FOUND AND NOT ALSOFT_NO_QT5) + qt5_wrap_ui(UIS ${alsoft-config_UIS}) - set(alsoft-config_MOCS mainwindow.h) - QT4_WRAP_CPP(MOCS ${alsoft-config_MOCS}) + qt5_wrap_cpp(MOCS ${alsoft-config_MOCS}) add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS}) - target_link_libraries(alsoft-config ${QT_LIBRARIES}) + target_link_libraries(alsoft-config Qt5::Widgets) set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR}) if(TARGET build_version) @@ -30,4 +29,28 @@ if(QT4_FOUND) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +else() + # Need Qt 4.8.0 or newer for the iconset theme attribute to work + find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui) + if(QT4_FOUND) + include(${QT_USE_FILE}) + + qt4_wrap_ui(UIS ${alsoft-config_UIS}) + + qt4_wrap_cpp(MOCS ${alsoft-config_MOCS}) + + add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS}) + target_link_libraries(alsoft-config ${QT_LIBRARIES}) + set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR}) + if(TARGET build_version) + add_dependencies(alsoft-config build_version) + endif() + + install(TARGETS alsoft-config + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + endif() endif() -- cgit v1.2.3