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










                                                                                



                                                                                                               




                                                              
                                             
                           
                          
 


                      












                                                                                
                 




                          
                 














                                                                                
                                

                                           






                                                                                
                      
                        



                         
                    
                     



                                
                
                     
                    


                                
                
                    




                                                              
################################################################################
# General
################################################################################

PROJECT(printergui)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)

# set compiler optimizations for debug and release
IF (CMAKE_BUILD_TYPE STREQUAL "")
	SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic -fno-strict-aliasing -std=c++11")
SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-strict-aliasing -std=c++11")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic -fno-strict-aliasing -std=c++11")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-strict-aliasing -std=c++11" )

# local cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# this command finds libraries and sets all required variables
FIND_PACKAGE(Qt5 COMPONENTS Widgets REQUIRED)
FIND_PACKAGE(Cups REQUIRED)
FIND_PACKAGE(X11 REQUIRED)

SET(CMAKE_AUTOMOC ON)
#SET(CMAKE_AUTORCC ON)

# some includes
INCLUDE_DIRECTORIES(
	${CMAKE_SOURCE_DIR}
	${CMAKE_BINARY_DIR}
)

################################################################################
# Variables
################################################################################

# printergui (maingui)
FILE(GLOB MAINGUI_SRCS
	src/maingui/*.cpp
	src/*.cpp
)

# password gui (printpwgui
FILE(GLOB PWGUI_SRCS
	src/pwgui/*.cpp
	src/*.cpp
)

################################################################################
# Qt
################################################################################

# .ui files
FILE(GLOB MAINGUI_UIS
	src/maingui/*.ui
)

FILE(GLOB PWGUI_UIS
	src/pwgui/*.ui
)

# this will run uic on .ui files
QT5_WRAP_UI(MAINGUI_UI_HDRS ${MAINGUI_UIS})
QT5_WRAP_UI(PWGUI_UI_HDRS ${PWGUI_UIS})

################################################################################
# Build
################################################################################

ADD_EXECUTABLE(printergui
    ${MAINGUI_SRCS}
    ${MAINGUI_UI_HDRS}
#     ${MAINGUI_RC_SRCS}
)

ADD_EXECUTABLE(printpwgui
    ${PWGUI_SRCS}
    ${PWGUI_UI_HDRS}
#    ${PWGUI_RC_SRCS}
)

# link
TARGET_LINK_LIBRARIES(printergui
    Qt5::Widgets
    ${CUPS_LIBRARIES}
    ${X11_LIBRARIES}
)

TARGET_LINK_LIBRARIES(printpwgui
    Qt5::Widgets
    ${X11_LIBRARIES}
)

# install
INSTALL(TARGETS printergui printpwgui RUNTIME DESTINATION bin)