Source

surfer / CMakeLists.txt

Full commit
# Copyright (C) 2011 by Ivan Andrianov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

project(SURFER)

cmake_minimum_required(VERSION 2.6.0)

find_package(Qt4 4.6.0 COMPONENTS QtCore QtGui QtNetwork QtSql QtWebKit
             REQUIRED)

include_directories(${CMAKE_SOURCE_DIR} ${SURFER_SOURCE_DIR}
                    ${SURFER_BINARY_DIR})

set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTSQL TRUE)
set(QT_USE_QTWEBKIT TRUE)

if(WIN32)
  set(QT_USE_QTMAIN TRUE)
endif(WIN32)

include(${QT_USE_FILE})

if(WIN32)
  set(SURFER_BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
  set(SURFER_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
  set(SURFER_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else(WIN32)
  set(CMAKE_CXX_FLAGS "-fvisibility=hidden")
  set(SURFER_BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
  string(COMPARE EQUAL ${CMAKE_SYSTEM_PROCESSOR} x86_64 IS64BIT)
  if(IS64BIT)
    set(SURFER_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib64)
  else(IS64BIT)
    set(SURFER_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
  endif(IS64BIT)
  set(SURFER_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/surfer)
endif(WIN32)

add_subdirectory(src/bookmarks)
add_subdirectory(src/downloads)
add_subdirectory(src/history)
add_subdirectory(src/network)
add_subdirectory(src/ui)
add_subdirectory(src/web)

set(SURFER_SRCS_CXX
  src/application.cpp
  src/main.cpp
)

set(SURFER_MOC_SRCS
  src/application.h
  src/application_p.h
)

set(SURFER_TSS
  ts/pt_BR.ts
  ts/ru_RU.ts
)

qt4_wrap_cpp(SURFER_SRCS_CXX ${SURFER_MOC_SRCS})

qt4_add_translation(SURFER_SRCS_CXX ${SURFER_TSS})

if(WIN32)
  add_executable(surfer WIN32 ${SURFER_SRCS_CXX} src/main.rc)
else(WIN32)
  add_executable(surfer ${SURFER_SRCS_CXX})
endif(WIN32)

target_link_libraries(surfer surfer_history surfer_ui surfer_web
                      ${QT_LIBRARIES})

install(TARGETS surfer RUNTIME DESTINATION ${SURFER_BIN_INSTALL_DIR})

install(FILES ${SURFER_BINARY_DIR}/pt_BR.qm ${SURFER_BINARY_DIR}/ru_RU.qm
        DESTINATION ${SURFER_DATA_INSTALL_DIR}/translations)

if(WIN32)
  install(FILES license.rtf DESTINATION ${SURFER_DATA_INSTALL_DIR})
else(WIN32)
  install(FILES license.txt DESTINATION ${SURFER_DATA_INSTALL_DIR})
endif(WIN32)

if(UNIX)
  install(FILES surfer.desktop
          DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
endif(UNIX)