Cross compile a project to vxWorks on Windows 10 host

Hi,
I am trying to cross compile an existing project to vxWorks. From the research I have done, it seems that a simple tool chain file should accomplish this. However, it seems CMake does not detect the cross compiler. When I run cmake, with this tool chain file
cmake .. -DCMAKE_TOOLCHAIN_FILE=..\gcc_vxworks412.cmake, I get this output

-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.28.29334.0
System is unknown to cmake, create: etc.....

It seems the host compiler is used. Further evidence of this in the CMakeError.log file

Determining if the include file getopt.h exists failed with the following output:
Change Dir: C:/Projects/DDS/cyclonedds/buildvx/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe cmTC_669c8.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.8.2+25e4d540b for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29334 for x64
  Copyright (C) Microsoft Corporation.  All rights reserved.
  CheckIncludeFile.c

  cl /c /I"C:\WindRiver\vxworks-6.8\target\h" /I"C:\WindRiver\vxworks-6.8\target\h\coreip" /W1 /WX- /diagnostics:column /O2 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_669c8.dir\Debug\\" /Fd"cmTC_669c8.dir\Debug\vc142.pdb" /Gd /TC /errorReport:queue C:\Projects\DDS\cyclonedds\buildvx\CMakeFiles\CMakeTmp\CheckIncludeFile.c

C:\Projects\DDS\cyclonedds\buildvx\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: 'getopt.h': No such file or directory [C:\Projects\DDS\cyclonedds\buildvx\CMakeFiles\CMakeTmp\cmTC_669c8.vcxproj]

It still calls the host compiler (cl) where I expected the target compiler.

I kept the tool chain file simple :

set(CMAKE_SYSTEM_NAME VxWorks)

set(CMAKE_C_COMPILER C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/ccpentium.exe)
set(CMAKE_CXX_COMPILER C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/c++pentium.exe)
INCLUDE_DIRECTORIES (C:/WindRiver/vxworks-6.8/target/h C:/WindRiver/vxworks-6.8/target/h/coreip)

# here is the target environment located
#SET(CMAKE_FIND_ROOT_PATH  C:/WindRiver/vxworks-6.8/target) 
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

From all the discussion and documentation that I have seen, this tool chain file should invoke the cross compiler, but it does not.
Any help will be appreciated

Thank you

You need to specify a non-VS generator. Visual Studio only supports toolchains specifiable with -T and -A. Does it work if you add -G Ninja to your first attempt?

I will try Ninja - which is not installed on my system currently. I will install and try it out.
Thanks for the suggestion

I ran CMake with the Ninja generator but get this error:

CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!

It seems that ninja is not on the path, but it is, since I added the ninja executable to the PATH and verified it is with ninja -h (this prints the ninja help message).

The CMake command was : cmake -G Ninja ..

Ok, it seems the path must be added explicitly with
cmake -DCMAKE_MAKE_PROGRAM=c:\Projects\ninja-master\build-cmake\Release\ninja -G Ninja ..
This got me further. This generated some build files (seems like CMake and ninja files). Which build system should one use from this point on: CMake or Ninja ?

You can use either ninja or cmake --build . to build. The latter works with any generator.

If the vxWorks toolchain supports being specified via -T, you can use the Visual Studio generator, but I have no idea how that might be spelled.