Update for app framework removal
[apps/camera-gstreamer.git] / app / CMakeLists.txt
index 02322d4..fc71e8f 100644 (file)
@@ -1,5 +1,5 @@
 ###########################################################################
-# Copyright 2018 Konsulko Group
+# Copyright 2018,2022 Konsulko Group
 # Copyright 2020 Collabora, Ltd.
 #
 # Author: Scott Murray <scott.murray@konsulko.com>
 # limitations under the License.
 ###########################################################################
 
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+project(camera-gstreamer)
+
+if(CMAKE_VERSION VERSION_LESS "3.7.0")
+    set(CMAKE_INCLUDE_CURRENT_DIR ON)
+endif()
+
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 find_package(PkgConfig REQUIRED)
 find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
 
-PROJECT_TARGET_ADD(camera-gstreamer)
-
 add_custom_command(
        OUTPUT  agl-shell-desktop-client-protocol.h
        COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
@@ -35,7 +38,6 @@ add_custom_command(
        DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
 )
 
-
 add_custom_command(
        OUTPUT  ${CMAKE_BINARY_DIR}/app/agl-shell-desktop-client-protocol.h
        COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
@@ -52,7 +54,6 @@ add_custom_command(
        DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell-desktop.xml
 )
 
-
 pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
 pkg_check_modules(GSTREAMER_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
 pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
@@ -70,7 +71,6 @@ add_custom_command(
        DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
 )
 
-
 add_custom_command(
        OUTPUT  ${CMAKE_BINARY_DIR}/app/xdg-shell-client-protocol.h
        COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
@@ -87,7 +87,7 @@ add_custom_command(
        DEPENDS ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
 )
 
-add_executable(${TARGET_NAME}
+add_executable(${PROJECT_NAME}
        main.cpp
        utils.h
        utils.cpp
@@ -105,16 +105,7 @@ include_directories(
        "${GSTREAMER_VIDEO_INCLUDE_DIRS}"
 )
 
-set_target_properties(${TARGET_NAME} PROPERTIES
-       LABELS "EXECUTABLE"
-       PREFIX ""
-       COMPILE_FLAGS "${EXTRAS_CFLAGS} -DFOR_AFB_BINDING"
-       LINK_FLAGS "${BINDINGS_LINK_FLAG}"
-       LINK_LIBRARIES "${EXTRAS_LIBRARIES}"
-       OUTPUT_NAME "${TARGET_NAME}"
-)
-
-target_link_libraries(${TARGET_NAME}
+target_link_libraries(${PROJECT_NAME}
        ${GSTREAMER_LIBRARIES}
        "${GSTREAMER_PLUGINS_BASE_LIBRARIES}"
        "${GSTREAMER_PLUGINS_BAD_LIBRARIES}"
@@ -122,3 +113,7 @@ target_link_libraries(${TARGET_NAME}
        ${WAYLAND_CLIENT_LIBRARIES}
        -lgstwayland-1.0
 )
+
+install(TARGETS ${PROJECT_NAME} DESTINATION bin)
+include(GNUInstallDirs)
+install(FILES ${PROJECT_NAME}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)