0001-agent-add-install-target-to-the-CMakeLists.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 96c43b223c90746cb2f680d6d5e198afc690dd4d Mon Sep 17 00:00:00 2001
  2. From: Norbert Lange <nolange79@gmail.com>
  3. Date: Mon, 4 Dec 2017 10:56:45 +0100
  4. Subject: [PATCH] agent: add install target to the CMakeLists
  5. It is common for CMake packages to make sure that 'make install'
  6. works properly, and that's what most users expect.
  7. More specifically, build systems such as Buildroot also expect
  8. 'make install' to do the right thing for CMake-based packages
  9. Signed-off-by: Norbert Lange <nolange79@gmail.com>
  10. ---
  11. agent/CMakeLists.txt | 14 ++++++++++++++
  12. 1 file changed, 14 insertions(+)
  13. diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt
  14. index aef15b96..605862b2 100644
  15. --- a/agent/CMakeLists.txt
  16. +++ b/agent/CMakeLists.txt
  17. @@ -1,6 +1,8 @@
  18. # -*- cmake -*-
  19. cmake_minimum_required(VERSION 2.8)
  20. +project(tcfagent C)
  21. +include(GNUInstallDirs)
  22. set(CMAKE_COLOR_MAKEFILE OFF)
  23. @@ -43,3 +45,15 @@ message(STATUS "machine:" ${TCF_MACHINE})
  24. add_executable(agent tcf/main/main.c)
  25. target_link_libraries(agent ${TCF_LIB_NAME})
  26. +
  27. +# executable and library cant have the same target name,
  28. +# but we can rename the output
  29. +set_target_properties(agent
  30. + PROPERTIES OUTPUT_NAME tcf-agent)
  31. +
  32. +# add target to install all outputs
  33. +install(TARGETS agent ${TCF_LIB_NAME}
  34. + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
  35. + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  36. + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  37. +)
  38. --
  39. 2.15.1