celestia/src/celestia/qt/CMakeLists.txt

82 lines
2.0 KiB
CMake

if(NOT ENABLE_QT)
message("Qt frontend is disabled.")
return()
endif()
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
endif()
set(QT_LIBS Widgets OpenGL)
find_package(Qt5 COMPONENTS ${QT_LIBS} CONFIG REQUIRED)
set(QT_SOURCES
qtappwin.cpp
qtbookmark.cpp
qtcelestialbrowser.cpp
qtcelestiaactions.cpp
qtcolorswatchwidget.cpp
qtdeepskybrowser.cpp
qteventfinder.cpp
qtglwidget.cpp
qtgotoobjectdialog.cpp
qtinfopanel.cpp
qtmain.cpp
qtpreferencesdialog.cpp
qtselectionpopup.cpp
qtsettimedialog.cpp
qtsolarsystembrowser.cpp
qttimetoolbar.cpp
xbel.cpp
)
set(QT_HEADERS
qtappwin.h
qtbookmark.h
qtcelestialbrowser.h
qtcelestiaactions.h
qtcolorswatchwidget.h
qtdeepskybrowser.h
qteventfinder.h
qtgettext.h
qtgotoobjectdialog.h
qtglwidget.h
qtinfopanel.h
qtpreferencesdialog.h
qtselectionpopup.h
qtsettimedialog.h
qtsolarsystembrowser.h
qttimetoolbar.h
xbel.h
)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_add_resources(RC_SRC "icons.qrc")
if(WIN32)
set (RES celestia.rc)
endif()
add_executable(celestia-qt WIN32 ${QT_SOURCES} ${RC_SRC} ${RES})
cotire(celestia-qt)
qt5_use_modules(celestia-qt ${QT_LIBS})
target_link_libraries(celestia-qt ${CELESTIA_LIBS})
if(APPLE)
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreFoundation")
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreServices")
endif()
if(NATIVE_OSX_APP)
install(TARGETS celestia-qt RUNTIME DESTINATION MacOS)
install(FILES ../macosx/celestia.icns DESTINATION Resources)
else()
install(TARGETS celestia-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()