Mentions légales du service

Skip to content
Snippets Groups Projects
CMakeLists.txt 1.66 KiB
Newer Older
cmake_minimum_required(VERSION 3.7)
Mattéo Delabre's avatar
Mattéo Delabre committed
project(rmvncclient)
# Import libvncserver in static mode
set(BUILD_SHARED_LIBS OFF CACHE STRING "" FORCE)
set(WITH_GNUTLS OFF CACHE STRING "" FORCE)
add_subdirectory(libvncserver)

# Options for building rmvncclient
Mattéo Delabre's avatar
Mattéo Delabre committed
option(CHECK_INCLUDES "Run include-what-you-use to check #includes" OFF)
Mattéo Delabre's avatar
Mattéo Delabre committed
option(CHECK_TIDY "Run clang-tidy linter" OFF)
Mattéo Delabre's avatar
Mattéo Delabre committed
option(TRACE "Print tracing messages on standard output" OFF)

if(CHECK_INCLUDES)
    find_program(IWYU_PATH include-what-you-use)

    if(NOT IWYU_PATH)
        message(FATAL_ERROR "Could not find include-what-you-use")
    endif()
Mattéo Delabre's avatar
Mattéo Delabre committed
    set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
endif()
Mattéo Delabre's avatar
Mattéo Delabre committed
if(CHECK_TIDY)
    find_program(TIDY_PATH clang-tidy)

    if(NOT TIDY_PATH)
        message(FATAL_ERROR "Could not find clang-tidy")
    endif()

    set(CMAKE_CXX_CLANG_TIDY ${TIDY_PATH};-fix)
endif()

if(TRACE)
Mattéo Delabre's avatar
Mattéo Delabre committed
    message(STATUS "Trace mode enabled")
    add_definitions(-DTRACE)
Mattéo Delabre's avatar
Mattéo Delabre committed
endif()

Mattéo Delabre's avatar
Mattéo Delabre committed
add_executable(rmvncclient
    src/app/buttons.cpp
    src/app/client.cpp
    src/app/pen.cpp
    src/app/screen.cpp
    src/app/touch.cpp
    src/rmioc/buttons.cpp
    src/rmioc/input.cpp
    src/rmioc/pen.cpp
    src/rmioc/screen.cpp
Mattéo Delabre's avatar
Mattéo Delabre committed
    src/main.cpp
Mattéo Delabre's avatar
Mattéo Delabre committed
)

if(CMAKE_VERSION VERSION_LESS "3.8")
    if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
    else()
        message(FATAL_ERROR "Unknown compiler")
    endif()
else()
    set_property(TARGET rmvncclient PROPERTY CXX_STANDARD 17)
endif()

Mattéo Delabre's avatar
Mattéo Delabre committed
target_link_libraries(rmvncclient PRIVATE vncclient)
target_include_directories(rmvncclient PRIVATE
    ${CMAKE_CURRENT_BINARY_DIR}/libvncserver
    libvncserver
)