cmake_minimum_required(VERSION 3.30) project(isolationrunner) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD 17) find_package(Qt6 COMPONENTS Core Widgets DBus REQUIRED) # starting with Qt5.15 we have a lot of deprecation warnings, # likely to make porting to Qt6 easier. # as long as we require linking to older Qt versions those warnings # are clutter. Remove this define when we start porting to Qt6. add_definitions(-DQT_NO_DEPRECATED_WARNINGS) set (SERVER_SOURCES main.cpp DBusConnection.cpp Message.cpp RemoteRunner.cpp Runner.cpp IsolationManager.cpp ) add_executable(isolation_runner ${SERVER_SOURCES}) target_link_libraries(isolation_runner Qt6::Core Qt6::DBus Qt6::Widgets) if ("$ENV{HOME}" STREQUAL "/root") # hacky way to know if we're root. # setuid is needed, we can apply that when root installs it. install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/isolation_runner PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID DESTINATION bin) else () install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/isolation_runner DESTINATION bin) endif () set (UTIL_SOURCES util/client.cpp ) add_executable(iso ${UTIL_SOURCES}) target_link_libraries(iso Qt6::Core Qt6::DBus) install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/iso DESTINATION bin)