File: CMakeLists.txt

package info (click to toggle)
peg-solitaire 2.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,136 kB
  • sloc: cpp: 4,893; xml: 32; makefile: 9
file content (109 lines) | stat: -rw-r--r-- 4,158 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
SET(CMAKE_INSTALL_PREFIX /$(CURDIR)/usr)
 # set project's name
  PROJECT( peg-solitaire )
 
  cmake_minimum_required(VERSION 3.5)
  
  # with SET() command you can change variables or define new ones
  # here we define SAMPLE_SRCS variable that contains a list of all .cpp files
  # note that we don't need \ at the end of line
  SET( peg-solitaire_SRCS
	./scr/main.cpp
       	./scr/funcions.cpp 
	./scr/rellotge.cpp 
	./scr/frmprincipal.cpp
	./scr/fitxa.cpp
	./scr/moviment.cpp
	./scr/tauler.cpp
  )
  
  # another list, this time it includes all header files that should be treated with moc
  SET( peg-solitaire_MOC_HDRS 
       	./scr/funcions.h
	./scr/rellotge.h 
	./scr/frmprincipal.h
	./scr/fitxa.h
	./scr/moviment.h
	./scr/tauler.h    
  )
  
  # some .ui files
  #SET( peg-solitaire_UIS
  #     ./scr/frmDesaFigura.ui
  #)
  
  # and finally an resource file
 # SET( peg-solitaire_RCS
 #     resources.qrc
 # )
  
  # enable warnings
  ADD_DEFINITIONS( -Wall )
  
  # by default only QtCore and QtGui modules are enabled
  # other modules must be enabled like this:
  #SET( QT_USE_QT3SUPPORT TRUE )   
  SET( QT_USE_QTXML TRUE )
  set(QT_USE_QTNETWORK true) 
  #set(QT_USE_TESTLIB true)
  set(QT_USE_QTSVG true)
  set(QT_USE_QTDBUS true)
  
  # this command finds Qt5 libraries and sets all required variables
  # note that it's Qt5, not QT5 or qt5
  find_package(Qt5Widgets)
  #find_package(Qt5Declarative)

  # The Qt5Widgets_INCLUDES also includes the include directories for
  # dependencies QtCore and QtGui
  include_directories(${Qt5Widgets_INCLUDES})

  # We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
  add_definitions(${Qt5Widgets_DEFINITIONS})
  
  # add some useful macros and variables
  # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)
  #INCLUDE( ${QT_USE_FILE} )
  
  # this command will generate rules that will run rcc on all files from peg-solitaire_RCS
  # in result peg-solitaire_RC_SRCS variable will contain paths to files produced by rcc
  #QT4_ADD_RESOURCES( peg-solitaire_RC_SRCS ${peg-solitaire_RCS} )
  
  # this will run uic on .ui files:
  #QT5_WRAP_UI( peg-solitaire_UI_HDRS ${peg-solitaire_UIS} )
  
  # and finally this will run moc:
  QT5_WRAP_CPP( peg-solitaire_MOC_SRCS ${peg-solitaire_MOC_HDRS} )
  
  # we need this to be able to include headers produced by uic in our code
  # (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
  INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )
  
  # binaries are placed in the root directory as the source code
  SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${peg-solitaire_SOURCE_DIR})
  # here we instruct CMake to build "peg-solitaire" executable from all of the source files
  ADD_EXECUTABLE( peg-solitaire ${peg-solitaire_SRCS} ${peg-solitaire_MOC_SRCS} )
  
  # last thing we have to do is to tell CMake what libraries our executable needs,
  # luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
  #TARGET_LINK_LIBRARIES( peg-solitaire ${QT_LIBRARIES} 
  #			${QT_QTMAIN_LIBRARY}
  #			${QT_QTTEST_LIBRARY})

  target_link_libraries(peg-solitaire ${Qt5Widgets_LIBRARIES})

  # install executable and translation files
install_targets(/games peg-solitaire)
 # INSTALL( TARGETS ${PROGNAME} DESTINATION bin )
  install(DIRECTORY games/ DESTINATION share/games/peg-solitaire/games)
  install(DIRECTORY locales/ DESTINATION share/games/peg-solitaire/locales)
  install(DIRECTORY images/ DESTINATION share/games/peg-solitaire/images)
  install(DIRECTORY help/ DESTINATION share/games/peg-solitaire/help)
  install(FILES menu/peg-solitaire.6.gz DESTINATION share/man/man6)
  install(FILES menu/peg-solitaire.desktop DESTINATION share/applications)
  install(FILES menu/peg-solitaire.appdata.xml DESTINATION share/metainfo)
  install(FILES images/peg-solitaire.xpm DESTINATION share/pixmaps)

 #uninstall
CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )