CMake build error for PC Simulator demo

Dear all,

I tried to use CMake to build the Amazon FreeRTOS Demo for PC Simulator (as a starting point).
I followed the instructions here: Using CMake with FreeRTOS - FreeRTOS.
The source code is downloaded from Github: Release Version 202002.00 · aws/amazon-freertos · GitHub (tag 202002.00).
I used CMake 3.16.0, GUI, and MinGW.

Firstly, I encountered problem about “Unknown CMake command “afr_set_board_metadata””.

I managed to include all .cmake files to \vendors\pc\boards\windows\CMakeLists.txt.

include(C:/Workspace/amazon-freertos-experiment/tools/cmake/afr.cmake OPTIONAL)

include(${AFR_ROOT_DIR}/vendors/pc/manifest.cmake OPTIONAL)
include(${AFR_ROOT_DIR}/tools/cmake/afr_board_paths.cmake OPTIONAL)
include(${AFR_ROOT_DIR}/tools/cmake/afr_metadata.cmake OPTIONAL)
include(${AFR_ROOT_DIR}/tools/cmake/afr_module.cmake OPTIONAL)

Then the configuration continued, though there were some warnings.

CMake Warning at C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_utils.cmake:55 (message):
Item
C:/Workspace/amazon-freertos-experiment/libraries/freertos_plus/aws/ota/test/aws_test_ota_cbor.c
already in list AFR_MODULE_test_ota_SOURCES_INTERFACE.
Call Stack (most recent call first):
C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_module.cmake:169 (afr_cache_append)
C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_module.cmake:177 (__afr_module_prop)
CMakeLists.txt:158 (afr_module_sources)

CMake Warning at C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_utils.cmake:55 (message):
Item
C:/Workspace/amazon-freertos-experiment/libraries/freertos_plus/aws/ota/test/aws_test_ota_cbor.c
already in list AFR_MODULE_test_ota_SOURCES_ALL.
Call Stack (most recent call first):
C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_module.cmake:170 (afr_cache_append)
C:/Workspace/amazon-freertos-experiment/tools/cmake/afr_module.cmake:177 (__afr_module_prop)
CMakeLists.txt:158 (afr_module_sources)

However, when I generated CMake files, it said “target was not found” for the portable targets such as freertos_plus_tcp, dev_mode_key_provisioning, utils…

These targets were already configured in CMakeLists.txt.

FreeRTOS Plus TCP

afr_mcu_port(freertos_plus_tcp)
target_sources(
AFR::freertos_plus_tcp::mcu_port
INTERFACE
“${AFR_MODULES_FREERTOS_PLUS_DIR}/standard/freertos_plus_tcp/source/portable/BufferManagement/BufferAllocation_2.c”
“${AFR_MODULES_FREERTOS_PLUS_DIR}/standard/freertos_plus_tcp/source/portable/NetworkInterface/WinPCap/NetworkInterface.c”
)
target_include_directories(
AFR::freertos_plus_tcp::mcu_port
INTERFACE
“${AFR_MODULES_FREERTOS_PLUS_DIR}/standard/freertos_plus_tcp/source/portable/Compiler/MSVC”
)
target_link_libraries(
AFR::freertos_plus_tcp::mcu_port
INTERFACE 3rdparty::win_pcap
)

Could anyone support me with a clue?

Hi Wolverine,

Thank you for providing such detailed information. Manual modifications to the CMake files are not required to run the Windows Device Simulator demo. This demo does however require some setup that is specific to the Windows Device Simulator device. These instructions provide information on using both Visual Studio and the CMake GUI to run the demo. Are you familiar with these instructions?