## Dir ./almanaque

project (almanaque CXX)

cmake_minimum_required (VERSION 3.0)

if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  message (FATAL_ERROR "It is not advisable to run cmake from the root directory. Instead create a new directory and run 'cmake ../' from it. Should delete files that cmake created in the root directory (CMakeCache.txt and CMakeFiles/).")
endif ()

set (PROJECT_VERSION 1.0)
set (PROJECT_NAME almanaque)
set (PROJECT_NAME_CAPITALIZED Almanaque)
set (PROJECT_PREFIX ${CMAKE_INSTALL_PREFIX})
set (DATADIR ${CMAKE_INSTALL_PREFIX}/share)
set (HOME $ENV{HOME})
set (USER_CONFIG_DIR ${HOME}/.config/${PROJECT_NAME})

# If no language is specified on the command line with:
# cmake ../ -DUSERDOC_LANG=xx
# Spanish ('es') is default used.
if ("${USERDOC_LANG}" STREQUAL "")
  set(USERDOC_LANG es)
endif()

set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)

add_definitions (-O2 -Wall -pedantic -ansi -std=c++1y)

include_directories (${PROJECT_SOURCE_DIR}/src)

find_package (XercesC REQUIRED)
if (XercesC_FOUND)
  include_directories (${XercesC_INCLUDE_DIRS})
  set (LIBS ${LIBS} ${XercesC_LIBRARIES})
else ()
  message (FATAL_ERROR "-- XercesC not found.")
endif (XercesC_FOUND)

find_package (wxWidgets REQUIRED)
include ("${wxWidgets_USE_FILE}")
set (LIBS ${LIBS} ${wxWidgets_LIBRARIES})

add_subdirectory (src)

configure_file (
  ${PROJECT_SOURCE_DIR}/src/config.hpp.in
  ${PROJECT_SOURCE_DIR}/src/config.hpp
)

install (
  DIRECTORY langs
  DESTINATION  ${DATADIR}/${PROJECT_NAME}
)

install (
  DIRECTORY images
  DESTINATION ${DATADIR}/${PROJECT_NAME}
)

install(
  FILES ${CMAKE_SOURCE_DIR}/images/Almanaque.png
  DESTINATION /usr/share/icons
)

install(
  FILES Almanaque.desktop
  DESTINATION /usr/share/applications
)
