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