Browse Source

Conversion to CMake

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
master
Slávek Banko 4 years ago
parent
commit
b02e6dd208
5 changed files with 150 additions and 1 deletions
  1. 3
    0
      .gitmodules
  2. 80
    0
      CMakeLists.txt
  3. 1
    1
      avahi-tqt.pc.in
  4. 65
    0
      avahi-tqt/CMakeLists.txt
  5. 1
    0
      cmake

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
1
+[submodule "cmake"]
2
+	path = cmake
3
+	url = http://system@scm.trinitydesktop.org/scm/git/tde-common-cmake

+ 80
- 0
CMakeLists.txt View File

@@ -0,0 +1,80 @@
1
+#################################################
2
+#
3
+#  (C) 2015 Slávek Banko
4
+#  slavek (DOT) banko (AT) axis.cz
5
+#
6
+#  Improvements and feedback are welcome
7
+#
8
+#  This file is released under GPL >= 2
9
+#
10
+#################################################
11
+
12
+cmake_minimum_required( VERSION 2.8 )
13
+
14
+
15
+##### general package setup #####################
16
+
17
+project( avahi-tqt )
18
+set( PACKAGE avahi-tqt )
19
+set( PACKAGE_VERSION 0.6.30 )
20
+
21
+
22
+##### include essential cmake modules ###########
23
+
24
+include( FindPkgConfig )
25
+
26
+
27
+##### include our cmake modules #################
28
+
29
+set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
30
+include( TDEMacros )
31
+tde_setup_architecture_flags( )
32
+
33
+
34
+##### setup install paths #######################
35
+
36
+include( TDESetupPaths )
37
+tde_setup_paths( )
38
+
39
+
40
+##### configure checks ##########################
41
+
42
+find_package( TQt )
43
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
44
+set( MOC_TQT_SCRIPT "${TQT_PREFIX}/bin/moc-tqt" )
45
+if( NOT EXISTS ${MOC_TQT_SCRIPT} )
46
+  tde_message_fatal( "moc-tqt not found!\n Check tqt installation." )
47
+endif( NOT EXISTS ${MOC_TQT_SCRIPT} )
48
+
49
+message( STATUS "Checking for avahi-common library" )
50
+find_library( AVAHI_COMMON NAMES avahi-common )
51
+if( NOT AVAHI_COMMON )
52
+  tde_message_fatal( "avahi-common library are required, but not found on your system" )
53
+endif( )
54
+message( STATUS "  found ${AVAHI_COMMON}" )
55
+
56
+if( UNIX )
57
+  set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
58
+  add_definitions( -DHAVE_VISIBILITY_HIDDEN )
59
+endif( UNIX )
60
+
61
+
62
+#### pkg-config #################################
63
+
64
+set( prefix ${CMAKE_INSTALL_PREFIX} )
65
+string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}"
66
+        exec_prefix ${EXEC_INSTALL_PREFIX} )
67
+string( REGEX REPLACE "^${EXEC_INSTALL_PREFIX}" "\${exec_prefix}"
68
+        libdir ${LIB_INSTALL_DIR} )
69
+string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}"
70
+        includedir ${INCLUDE_INSTALL_DIR} )
71
+
72
+configure_file( ${CMAKE_PROJECT_NAME}.pc.in ${CMAKE_PROJECT_NAME}.pc @ONLY )
73
+install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc
74
+         DESTINATION ${PKGCONFIG_INSTALL_DIR} )
75
+
76
+
77
+##### build #####################################
78
+
79
+tde_auto_add_subdirectories()
80
+

+ 1
- 1
avahi-tqt.pc.in View File

@@ -1,7 +1,7 @@
1 1
 prefix=@prefix@
2 2
 exec_prefix=${prefix}
3 3
 libdir=@libdir@
4
-includedir=${prefix}/include
4
+includedir=@includedir@
5 5
 
6 6
 Name: avahi-tqt
7 7
 Description: Avahi Multicast DNS Responder (TQT Support)

+ 65
- 0
avahi-tqt/CMakeLists.txt View File

@@ -0,0 +1,65 @@
1
+#################################################
2
+#
3
+#  (C) 2015 Slávek Banko
4
+#  slavek (DOT) banko (AT) axis.cz
5
+#
6
+#  Improvements and feedback are welcome
7
+#
8
+#  This file is released under GPL >= 2
9
+#
10
+#################################################
11
+
12
+include_directories(
13
+  ${CMAKE_BINARY_DIR}
14
+  ${CMAKE_CURRENT_BINARY_DIR}
15
+  ${CMAKE_CURRENT_SOURCE_DIR}
16
+  ${TQT_INCLUDE_DIRS}
17
+)
18
+
19
+link_directories(
20
+  ${TQT_LIBRARY_DIRS}
21
+)
22
+
23
+
24
+##### library ###################################
25
+
26
+set( target avahi-tqt )
27
+
28
+tde_add_library(
29
+  ${target} SHARED
30
+  VERSION 1.0.0
31
+  SOURCES qt-watch.cpp
32
+  LINK ${AVAHI_COMMON} ${TQT_LIBRARIES}
33
+  DESTINATION ${LIB_INSTALL_DIR}
34
+)
35
+
36
+tde_add_library(
37
+  ${target} STATIC_PIC
38
+  SOURCES qt-watch.cpp
39
+  LINK ${AVAHI_COMMON} ${TQT_LIBRARIES}
40
+  DESTINATION ${LIB_INSTALL_DIR}
41
+)
42
+
43
+add_custom_command(
44
+  OUTPUT
45
+    qt-watch.moc3
46
+  COMMAND
47
+    ${MOC_TQT_SCRIPT}
48
+    ${MOC_EXECUTABLE}
49
+    ${CMAKE_CURRENT_SOURCE_DIR}/qt-watch.cpp
50
+    qt-watch.moc3
51
+)
52
+
53
+set_property(
54
+  SOURCE qt-watch.cpp
55
+  APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qt-watch.moc3
56
+)
57
+
58
+
59
+##### headers ###################################
60
+
61
+install(
62
+  FILES qt-watch.h
63
+  DESTINATION ${INCLUDE_INSTALL_DIR}/${CMAKE_PROJECT_NAME}
64
+)
65
+

+ 1
- 0
cmake

@@ -0,0 +1 @@
1
+Subproject commit 1994b808819fd74446cb8f1a0491b3e10244f463

Loading…
Cancel
Save