aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-13 23:43:41 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-13 23:43:41 -0500
commit35a8b1720631a6b700bf9a234d0444c3457ce197 (patch)
treeac78e5550187fd3d9f703209441d7d11cc8a7852 /src/CMakeLists.txt
parent3f29c1a35113bfd2461dca76235f1812c8dfd6ef (diff)
downloadayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.tar.gz
ayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.tar.bz2
ayatana-indicator-power-35a8b1720631a6b700bf9a234d0444c3457ce197.zip
replace autoconf/automake with cmake
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..a39b945
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,45 @@
+set (SERVICE_LIB "indicatorpowerservice")
+set (SERVICE_EXEC "indicator-power-service")
+
+add_definitions(-DG_LOG_DOMAIN="Indicator-Power")
+
+# handwritten sources
+set(SERVICE_MANUAL_SOURCES
+ device-provider-upower.c
+ ib-brightness-control.c
+ ib-brightness-uscreen-control.c
+ device-provider.c
+ device.c
+ service.c)
+
+# generated sources
+include(GdbusCodegen)
+set(SERVICE_GENERATED_SOURCES)
+add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-upower
+ org.freedesktop
+ Dbus
+ ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.UPower.xml)
+# add the bin dir to our include path so the code can find the generated header files
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+
+# add warnings/coverage info on handwritten files
+# but not the autogenerated ones...
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-bad-function-cast") # g_clear_object()
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-disabled-macro-expansion") # G_DEFINE_TYPE
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-assign-enum") # GParamFlags
+set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-switch-enum")
+set_source_files_properties(${SERVICE_MANUAL_SOURCES}
+ PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} ${GCOV_FLAGS} -g -std=c99")
+
+# the service library for tests to link against (basically, everything except main())
+add_library(${SERVICE_LIB} STATIC ${SERVICE_MANUAL_SOURCES} ${SERVICE_GENERATED_SOURCES})
+include_directories(${CMAKE_SOURCE_DIR})
+link_directories(${SERVICE_DEPS_LIBRARY_DIRS})
+
+# the executable: lib + main()
+add_executable (${SERVICE_EXEC} main.c)
+set_source_files_properties(${SERVICE_SOURCES} main.c PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} -g -std=c99")
+target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${GCOV_LIBS})
+install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR})
+