CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in
                ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/global.hxx.in
                ${CMAKE_CURRENT_BINARY_DIR}/global.hxx @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/archs.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/archs.h @ONLY)

SET(FILES_UI 
    ${CMAKE_CURRENT_SOURCE_DIR}/SavedParametersDialog.ui)
SET(FILES_H
    ${CMAKE_CURRENT_SOURCE_DIR}/SavedParametersDialog.h
    ${CMAKE_CURRENT_SOURCE_DIR}/ProgressHelper.h
    ${CMAKE_CURRENT_SOURCE_DIR}/LuminanceOptions.h)
SET(FILES_HXX
    #${CMAKE_CURRENT_SOURCE_DIR}/archs.h
    #${CMAKE_CURRENT_SOURCE_DIR}/config.h
    ${CMAKE_CURRENT_SOURCE_DIR}/TranslatorManager.h
    ${CMAKE_CURRENT_SOURCE_DIR}/CommonFunctions.h)
SET(FILES_CPP
    ${CMAKE_CURRENT_SOURCE_DIR}/SavedParametersDialog.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/global.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/LuminanceOptions.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/ProgressHelper.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/CommonFunctions.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/TranslatorManager.cpp)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

QT5_WRAP_CPP(FILES_MOC ${FILES_H})
QT5_WRAP_UI(FILES_UI_H ${FILES_UI})

ADD_LIBRARY(common ${FILES_H} ${FILES_CPP} ${FILES_MOC} ${FILES_HXX} ${FILES_UI_H}
    ${CMAKE_CURRENT_BINARY_DIR}/global.hxx
    ${CMAKE_CURRENT_BINARY_DIR}/config.h
    ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp)

qt5_use_modules(common Core Gui Widgets Xml Sql)

SET(FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${FILES_CPP} ${FILES_H} ${FILES_UI} ${FILES_HXX} PARENT_SCOPE)
SET(LUMINANCE_MODULES_GUI ${LUMINANCE_MODULES_GUI} common PARENT_SCOPE)
SET(LUMINANCE_MODULES_CLI ${LUMINANCE_MODULES_CLI} common PARENT_SCOPE)
