# Copyright (C) 2013 Ahmet Öztürk (aoz_2@yahoo.com) # # This file is part of Lifeograph. # # Lifeograph 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 3 of the License, or # (at your option) any later version. # # Lifeograph 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 Lifeograph. If not, see . cmake_minimum_required( VERSION 2.6 ) project( Lifeograph ) include( ${PROJECT_BINARY_DIR}/cmake/definitions.cmake ) add_definitions( -Wall -DHAVE_CONFIG_H ) # DEBUG BUILD if( ${CMAKE_BUILD_TYPE} MATCHES Debug ) set( DEBUG_BUILD 1 ) else() set( DEBUG_BUILD 0 ) endif() # PACKAGES find_package( PkgConfig REQUIRED ) find_library( GCRYPT gcrypt ) if( ${GCRYPT} MATCHES "GCRYPT-NOTFOUND" ) message( "Gcrypt library not found" ) return() endif() pkg_check_modules( GTKMM REQUIRED gtkmm-3.0>=3.4 ) pkg_check_modules( ENCHANT REQUIRED enchant ) # CONFIGURATION HEADER FILE configure_file( ${PROJECT_BINARY_DIR}/config.h.in ${BUILD_DIR}/config.h ) # add path of config.h include_directories( ${BUILD_DIR} ) include_directories( ${GTKMM_INCLUDE_DIRS} ${ENCHANT_INCLUDE_DIRS} ) #link_directories( ${GTKMM_LIBRARY_DIRS} ${ENCHANT_LIBRARY_DIRS} ) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIR} ) # INTLTOOL add_custom_command( OUTPUT ${pot_file} COMMAND intltool-update -p -g ${PACKAGE_NAME} COMMAND intltool-update -r -g ${PACKAGE_NAME} WORKING_DIRECTORY ${po_dir} ) add_custom_target( update-translations COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake/msgmerge.cmake DEPENDS ${pot_file} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) # based on Remmina code at https://github.com/FreeRDP/Remmina/blob/master/cmake/GETTEXT.cmake #function( gettext_msgfmt ) # set( mo_files ) # file( GLOB po_files ${CMAKE_CURRENT_BINARY_DIR}/po/*.po ) # foreach( po_file ${po_files} ) # get_filename_component( lang ${po_file} NAME_WE ) # set( mo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo ) # add_custom_command( OUTPUT ${mo_file} # COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file} # DEPENDS ${po_file} ) # install( FILES ${mo_file} # DESTINATION share/locale/${lang}/LC_MESSAGES # RENAME ${PACKAGE_NAME}.mo ) # set( mo_files ${mo_files} ${mo_file} ) # endforeach() # set( translations-target "${PACKAGE_NAME}-translations" ) # add_custom_target( ${translations-target} ALL DEPENDS ${mo_files} ) #endfunction() # config.h APPENDAGES if( ( EXISTS ${CMAKE_BINARY_DIR}/.bzr ) AND ( ${CMAKE_BUILD_TYPE} MATCHES Debug ) ) add_custom_target( APPEND_REV_NO ALL COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake/rev_no.cmake WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) else() file( WRITE ${BUILD_DIR}/rev_no.h "#define REVISION_NO \"\"" ) endif() # TARGETS add_executable( ${PACKAGE_NAME} src/dialog_export.cpp src/dialog_password.cpp src/dialog_preferences.cpp src/diary.cpp src/diarydata.cpp src/entry.cpp src/entry_parser.cpp src/helpers.cpp src/lifeobase.cpp src/lifeograph.cpp src/main.cpp src/panel_diary.cpp src/panel_extra.cpp src/panel_main.cpp src/printing.cpp src/settings.cpp src/undo.cpp src/view_entry.cpp src/view_login.cpp src/views.cpp src/widget_chart.cpp src/widget_entrylist.cpp src/widget_tag_list.cpp src/widget_textview.cpp ) target_link_libraries( ${PACKAGE_NAME} ${GTKMM_LIBRARIES} ${ENCHANT_LIBRARIES} ${GCRYPT} )