#
#   Copyright (C) 2008  Tim Fechtner < urwald at users dot sourceforge dot net >
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2 of
#   the License or (at your option) version 3 or any later version
#   accepted by the membership of KDE e.V. (or its successor approved
#   by the membership of KDE e.V.), which shall act as a proxy
#   defined in Section 14 of version 3 of the license.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#



# preparations
include(${QT_USE_FILE})
include(KDE4Defaults)  # some special KDE4 options for cmake
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
  ${QT_INCLUDE}
  ${KDE4_INCLUDES}
  ./
  qt-extensions/src
  radiostation
  radiostation/service_classes
  radiostation/settings_stream
  settings_general
  ${CMAKE_CURRENT_BINARY_DIR}/radiostation/settings_stream
  ${CMAKE_CURRENT_BINARY_DIR}/settings_general)



# static lib
add_subdirectory(qt-extensions)



# define source files which are part of the project and have to be compiled
set(kradioripper_SRCS
  ${kradioripper_SRCS}
  main.cpp mainwindow.cpp
  stationlistmodel.cpp
  stationlistwidget.cpp)

set(kradioripper_SRCS
  ${kradioripper_SRCS}
  qt-extensions/src/customizableheaderview.cpp
  qt-extensions/src/console_reader.cpp
  qt-extensions/src/stationdirectorytree.cpp
  qt-extensions/src/streamdirectoryservice.cpp
  qt-extensions/src/versionnumber.cpp)

set(kradioripper_SRCS
  ${kradioripper_SRCS}
  radiostation/streamripper_base.cpp
  radiostation/ripping.cpp
  radiostation/radiostation.cpp
  radiostation/get_stream_info.cpp
  radiostation/get_streamripper_version.cpp)

set(kradioripper_SRCS
  ${kradioripper_SRCS}
  radiostation/service_classes/propertyvalue.cpp)

set(kradioripper_SRCS
  ${kradioripper_SRCS}
  radiostation/settings_stream/settings_stream_widget_connection.cpp
  radiostation/settings_stream/settings_stream_widget_splitting.cpp
  radiostation/settings_stream/settings_stream_widget_saving.cpp
  radiostation/settings_stream/settings_stream_dialog.cpp)
kde4_add_ui_files(kradioripper_SRCS
  radiostation/settings_stream/settings_stream_widget_connection.ui
  radiostation/settings_stream/settings_stream_widget_saving.ui
  radiostation/settings_stream/settings_stream_widget_splitting.ui)
kde4_add_kcfg_files(kradioripper_SRCS
  radiostation/settings_stream/settings_stream.kcfgc)
install(FILES radiostation/settings_stream/settings_stream.kcfg
  DESTINATION ${KCFG_INSTALL_DIR})

set(kradioripper_SRCS
  ${kradioripper_SRCS}
  settings_general/settings_general_widget_general.cpp
  settings_general/settings_general_widget_saving.cpp
  settings_general/settings_general_widget_relayserver.cpp
  settings_general/settings_general_dialog.cpp)
kde4_add_ui_files(kradioripper_SRCS
  settings_general/settings_general_widget_general.ui
  settings_general/settings_general_widget_saving.ui
  settings_general/settings_general_widget_relayserver.ui)
kde4_add_kcfg_files(kradioripper_SRCS
  settings_general/settings_general.kcfgc)
install(FILES settings_general/settings_general.kcfg
  DESTINATION ${KCFG_INSTALL_DIR})



# compile and link
kde4_add_executable(kradioripper ${kradioripper_SRCS})
# There is a possibility to make a target depend on a lib: add_dependencies(target dependency1 dependency2 ...)
target_link_libraries(kradioripper ${KDE4_KDEUI_LIBS} ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${QT_LIBRARIES})


# install
install(TARGETS kradioripper DESTINATION ${BIN_INSTALL_DIR})
