﻿# This file also works as the top-level CMakeLists.txt of its own project
# (cmake -S examples/profile_velocity_mode), which makes it the starting point for
# your own program. When you copy it, point the include() below at the folder where
# you unpacked the Motion Helper - see documentation/getting-started.md.
cmake_minimum_required(VERSION 3.21)

# --------------------------- Project Configuration -------------------------- #
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# RC is needed for the version resource below.
project(example_pvm VERSION 1.0.0 LANGUAGES CXX RC)

# Version resource shown by the Windows Explorer; the number comes from project()
# above, so it is maintained in one place.
configure_file(version.rc.in "${CMAKE_CURRENT_BINARY_DIR}/version.rc" @ONLY)

add_executable(${PROJECT_NAME}
    main.cpp
    "${CMAKE_CURRENT_BINARY_DIR}/version.rc"
)

# Motion Library and Motion Helper. If the Motion Library is not installed in its
# default location, set MOTION_LIBRARY_PATH before this line (see getting-started.md).
include("${CMAKE_CURRENT_LIST_DIR}/../../motion_helper.cmake")

# maxon_MotionHelper brings the Motion Library (headers and import library) along.
target_link_libraries(${PROJECT_NAME} PRIVATE
    maxon_MotionHelper
)

# The Motion Library DLL is not on PATH; this copies it next to the executable.
maxon_copy_motion_library_dll(${PROJECT_NAME})

# The example is meant to be read and copied, so it is built warning-free at /W4.
target_compile_options(${PROJECT_NAME} PRIVATE
    $<$<CXX_COMPILER_ID:MSVC>:/W4>
)
