summaryrefslogblamecommitdiffstats
path: root/CMakeLists.txt
blob: 4f6ca9c6cc4ce1eaf5ec68ca886aa8758f7eaafd (plain) (tree)
1
2
3
4
5
6
7
8





                                   
                                                         
                                  




                                                
                                              
 

                                                
 

     


                                



                                      




                       






















                                                                                                    

                                                              
                                                            








                          
                  



                               
 


                                                               
                                                                
cmake_minimum_required(VERSION 2.6)

# project name
project(vmchooser)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")

file(GLOB_RECURSE VMCHOOSER_SOURCES src/*.cpp)
file(GLOB_RECURSE VMCHOOSER_MOC_HEADERS src/*.h)
file(GLOB_RECURSE VMCHOOSER_UIS src/ui/*.ui)
file(GLOB_RECURSE VMCHOOSER_RESOURCES src/*.qrc)
file(GLOB_RECURSE VMCHOOSER_TSS src/i18n/*.ts)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

#
# Qt4
#
find_package(Qt4 4.5.0 REQUIRED)
if(QT4_FOUND)
  message(STATUS "Qt4 found")
else(QT4_FOUND)
  message(FATAL_ERROR "Qt4 not found")
endif(QT4_FOUND)

set(QT_USE_QTXML TRUE)
set(QT_USE_QTSVG TRUE)

include(${QT_USE_FILE})

option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)")
if(VMCHOOSER_TSS)
  if (UPDATE_TRANSLATIONS)
    set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${VMCHOOSER_SOURCES} ${VMCHOOSER_UIS})
    QT4_CREATE_TRANSLATION(VMCHOOSER_QMS ${FILES_TO_TRANSLATE} ${VMCHOOSER_TSS} OPTIONS -noobsolete)
    message(STATUS ".tr files have been updated")
  else (UPDATE_TRANSLATIONS)
    QT4_ADD_TRANSLATION(VMCHOOSER_QMS ${VMCHOOSER_TSS})
  endif (UPDATE_TRANSLATIONS)

  # write a resource file for qm files
  set(resource_file_content "<RCC>\n    <qresource prefix=\"/\">\n")
  foreach(file ${VMCHOOSER_QMS})
    get_filename_component(filename ${file} NAME)
    set(resource_file_content "${resource_file_content}        <file>${filename}</file>\n")
  endforeach(file)
  set(resource_file_content "${resource_file_content}    </qresource>\n</RCC>\n")
  file(WRITE "${CMAKE_BINARY_DIR}/translation.qrc" "${resource_file_content}")
  set(VMCHOOSER_RESOURCES ${VMCHOOSER_RESOURCES} "${CMAKE_BINARY_DIR}/translation.qrc")

  #add_custom_target(translations_target DEPENDS ${VMCHOOSER_QMS})
endif(VMCHOOSER_TSS)

QT4_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES})
QT4_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS})
QT4_WRAP_CPP(VMCHOOSER_MOC_SOURCES ${VMCHOOSER_MOC_HEADERS})

#
# build vmchooser
#
add_executable(vmchooser
  ${VMCHOOSER_SOURCES}
  ${VMCHOOSER_MOC_SOURCES}
  ${VMCHOOSER_UI_HEADERS}
  ${VMCHOOSER_RC_SOURCES}
  ${VMCHOOSER_QMS}
)

target_link_libraries(vmchooser
  ${QT_LIBRARIES}
)
	
install(TARGETS vmchooser RUNTIME DESTINATION bin)
install(FILES default.desktop DESTINATION /usr/share/xsessions)
install(DIRECTORY themes DESTINATION /usr/local/share/vmchooser)