Hotplug partition manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

94 lines
3.2 KiB

  1. #
  2. # CMakeLists.txt
  3. # Copyright (C) 2021 Aitor Cuadrado Zubizarreta <aitor_czr@gnuinos.org>
  4. #
  5. # This program is free software: you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by the
  7. # Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. # See the GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. # See the LICENSE file.#
  19. #
  20. cmake_minimum_required(VERSION 3.0.2-1)
  21. project(hopman)
  22. message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
  23. set(CMAKE_C_COMPILER_INIT gcc)
  24. set_source_files_properties(annex/*.c PROPERTIES LANGUAGE C )
  25. set_source_files_properties(watch/*.c PROPERTIES LANGUAGE C )
  26. set(CMAKE_CXX_COMPILER_INIT g++)
  27. set_source_files_properties(src/*.cpp PROPERTIES LANGUAGE CXX_STANDARD17 )
  28. set(CMAKE_INSTALL_PREFIX /usr)
  29. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/ModulesCMake")
  30. include(GNUInstallDirs)
  31. # set arch-specific include dir
  32. set(CMAKE_INSTALL_INCLUDEDIR "include/${CMAKE_LIBRARY_ARCHITECTURE}")
  33. set(CMAKE_INSTALL_LIBDIR "usr/lib/${DEB_HOST_MULTIARCH}")
  34. set(CMAKE_C_FLAGS "-Wall -g -lblkid -o -std=gnu17 -I/common" )
  35. set(CMAKE_C_FLAGS_DEBUG "-Wall -g -lblkid -o -std=gnu17 -I/common" )
  36. set(CMAKE_CXX_FLAGS "-Wall -g -lblkid -lX11 -o -Wc++0x-compat -pthread -std=gnu++17 -I/common -I/watch" )
  37. set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -lblkid -lX11 -o -Wc++0x-compat -pthread -std=gnu++17 -I/common -I/watch" )
  38. find_package(PkgConfig REQUIRED)
  39. pkg_check_modules(GLIBMM REQUIRED glibmm-2.4)
  40. pkg_check_modules(GTKMM REQUIRED gtkmm-2.4)
  41. list(APPEND DIR_LIST include ${GTKMM_INCLUDE_DIRS})
  42. include_directories(${DIR_LIST} common watch annex)
  43. add_subdirectory (annex)
  44. add_subdirectory (watch)
  45. add_subdirectory (gtkmm)
  46. # Translation
  47. if(LANGS_DIR)
  48. set (ALL_LINGUAS es)
  49. set (GETTEXT_PACKAGE hopman)
  50. add_subdirectory (po)
  51. endif()
  52. link_directories(${LINK_LIST})
  53. # Add other flags to the compiler
  54. add_definitions(${CFLAG_LIST})
  55. set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/../)
  56. set(CMAKE_BUILD_TYPE debug)
  57. add_executable(${PROJECT_NAME} main.cpp)
  58. add_executable("${PROJECT_NAME}-suid" suid.cpp)
  59. target_link_libraries(${PROJECT_NAME} hopmanui ${GLIBMM_LIBRARIES} ${GTKMM_LIBRARIES} annex watch X11)
  60. target_link_libraries("${PROJECT_NAME}-suid" hopmanui ${GLIBMM_LIBRARIES} ${GTKMM_LIBRARIES} annex watch X11)
  61. add_custom_command(
  62. OUTPUT suid_binary
  63. POST_BUILD
  64. COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} sudo chown root:root "${PROJECT_NAME}-suid"
  65. COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} sudo chmod u+s "${PROJECT_NAME}-suid"
  66. COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} rm -f "suid"
  67. COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR} mv "${PROJECT_NAME}-suid" "suid"
  68. DEPENDS "${PROJECT_NAME}-suid"
  69. COMMENT "Giving suid permissions to the server...\n"
  70. )
  71. add_custom_target(suid ALL DEPENDS suid_binary)