aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 16:15:23 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 23:30:01 +0200
commit3859fae9f80ab2a85e1926c48627c90355a927d1 (patch)
treeac4eee29d8b74ef1fb3d1bf409ab858962bff2fe /src/CMakeLists.txt
parent91282dafe2399a3da22f75f78690bc5bad563a76 (diff)
downloadlibayatana-common-3859fae9f80ab2a85e1926c48627c90355a927d1.tar.gz
libayatana-common-3859fae9f80ab2a85e1926c48627c90355a927d1.tar.bz2
libayatana-common-3859fae9f80ab2a85e1926c48627c90355a927d1.zip
GIR and Vala bindings: Properly detect GObjectIntrospection and Vala and disable GIR and Vala if not found.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 637ce9f..39682a7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,41 +30,43 @@ install(TARGETS ayatana-common DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
# AyatanaCommon.gir
-find_package(GObjectIntrospection REQUIRED QUIET)
-
-add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
- DEPENDS "ayatana-common"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND
- ${INTROSPECTION_SCANNER}
- utils.c utils.h
- --namespace=AyatanaCommon
- --c-include=ayatana/common/utils.h
- --quiet
- --warn-all
- --include=GLib-2.0
- --library="ayatana-common"
- --library-path=${CMAKE_CURRENT_BINARY_DIR}
- --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
-)
-
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
+if (INTROSPECTION_FOUND)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
+ DEPENDS "ayatana-common"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND
+ ${INTROSPECTION_SCANNER}
+ utils.c utils.h
+ --namespace=AyatanaCommon
+ --c-include=ayatana/common/utils.h
+ --quiet
+ --warn-all
+ --include=GLib-2.0
+ --library="ayatana-common"
+ --library-path=${CMAKE_CURRENT_BINARY_DIR}
+ --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
+ )
+
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
# AyatanaCommon.vapi
-find_package(Vala REQUIRED QUIET)
+ if (VALA_COMPILER)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND
+ ${VAPI_GEN}
+ --library=AyatanaCommon
+ AyatanaCommon.gir
+ )
-add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.gir"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND
- ${VAPI_GEN}
- --library=AyatanaCommon
- AyatanaCommon.gir
-)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")
+ add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi")
-add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi")
+ endif()
+
+endif()