set(EXE_NAME mcds_ambrosys_demo)
# -----------------------------------------------------------------------------
# Relevant source files and their virtual folders for IDE (source groups)
# -----------------------------------------------------------------------------
set(NO_GROUP_SRCS
    "${CMAKE_CURRENT_SOURCE_DIR}/mcds_lib_demo.cpp"    
)

target_sources(${EXE_NAME} PRIVATE ${NO_GROUP_SRCS} ${TAS_SRCS})

# -----------------------------------------------------------------------------
# Find relevant dependencies
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Add executable, its includes, and libraries
# -----------------------------------------------------------------------------
target_include_directories(${EXE_NAME}
    PRIVATE 
        "${CMAKE_CURRENT_SOURCE_DIR}"
        ${tas_client_api_INCLUDE_DIRS} 
)

target_link_libraries(${EXE_NAME} tas_client_api::tas_client mcds_configurator mcds_decoder mcds_recorder)

# -----------------------------------------------------------------------------
# Dependencies
# -----------------------------------------------------------------------------
add_dependencies(${EXE_NAME} mcds_configurator mcds_decoder mcds_recorder)

# Needed to for Visual Studio debug environement to locate the build dlls
# Note: not required for this project since all libraries and executable are defined in the top level CMakeLists file under mcds dir
set_target_properties(${EXE_NAME} 
    PROPERTIES 
        VS_DEBUGGER_ENVIRONMENT "PATH=$<TARGET_FILE_DIR:mcds_recorder>;%PATH%" # Paths are the same for decoder and configurator dll
)

# -----------------------------------------------------------------------------
# Compile definitions
# -----------------------------------------------------------------------------
if (MSVC)
    target_compile_definitions(${EXE_NAME} PRIVATE
        "$<$<CONFIG:Debug>:"
            "_DEBUG"
        ">"
        "$<$<CONFIG:Release>:"
            "NDEBUG"
        ">"
        "_CRT_SECURE_NO_WARNINGS"
        "_WIN32"
    )
elseif (UNIX)
    target_compile_definitions(${EXE_NAME} PRIVATE
        "UNIX"
    )
endif()

# -----------------------------------------------------------------------------
# Compile and link options
# -----------------------------------------------------------------------------
if (MSVC)
    target_compile_options(${EXE_NAME} PRIVATE
        /W3
        /MP
        /Gd
        /TP
    )

    target_link_options(${EXE_NAME} PRIVATE
        /INCREMENTAL
        /SUBSYSTEM:CONSOLE
    )
elseif (UNIX)
    target_compile_options(${EXE_NAME} PRIVATE
        -Wall;
    )
    target_link_libraries(${EXE_NAME} dl)
endif()

# -----------------------------------------------------------------------------
# Install
# -----------------------------------------------------------------------------