Search for and use Qt5 for alsoft-config
[openal-soft.git] / utils / alsoft-config / CMakeLists.txt
blob4911b9d8308af974bac540e98faef614889e5f5d
1 project(alsoft-config)
3 option(ALSOFT_NO_QT5 "Use Qt4 instead of Qt5 for alsoft-config" FALSE)
5 include_directories("${alsoft-config_BINARY_DIR}")
7 set(alsoft-config_SRCS  main.cpp
8                         mainwindow.cpp
10 set(alsoft-config_UIS  mainwindow.ui)
11 set(alsoft-config_MOCS  mainwindow.h)
13 find_package(Qt5Widgets)
14 if(Qt5Widgets_FOUND AND NOT ALSOFT_NO_QT5)
15     qt5_wrap_ui(UIS ${alsoft-config_UIS})
17     qt5_wrap_cpp(MOCS ${alsoft-config_MOCS})
19     add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS})
20     target_link_libraries(alsoft-config Qt5::Widgets)
21     set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
22     set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR})
23     if(TARGET build_version)
24         add_dependencies(alsoft-config build_version)
25     endif()
27     install(TARGETS alsoft-config
28             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
29             LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
30             ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
31     )
32 else()
33     # Need Qt 4.8.0 or newer for the iconset theme attribute to work
34     find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui)
35     if(QT4_FOUND)
36         include(${QT_USE_FILE})
38         qt4_wrap_ui(UIS ${alsoft-config_UIS})
40         qt4_wrap_cpp(MOCS ${alsoft-config_MOCS})
42         add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS})
43         target_link_libraries(alsoft-config ${QT_LIBRARIES})
44         set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
45         set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR})
46         if(TARGET build_version)
47             add_dependencies(alsoft-config build_version)
48         endif()
50         install(TARGETS alsoft-config
51                 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
52                 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
53                 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
54         )
55     endif()
56 endif()