As I recall for myself, simply using the Visual Studio Generator with the -A option was all that was needed to build for Win32. You don't need a toolchain file because the generator already knows how to setup a Visual Studio Project to target Win32. Even the documentation for cross-compiling doesn't show a need to setup toolchain file for cross compiling in this case.
I personally never seen anyone try to use the Ninja generator via command line CMake and use the cl.exe compiler. I've only seen that using Visual Studio to open a CMakeLists.txt file it can produce a Ninja project. But even MS documentation states that it doesn't always work. https://stackoverflow.com/questions/31262342/cmake-g-ninja-on-windows-specify-x64 This says you should be able to open the proper development window and use Ninja. The output shows that in the environment you are using it doesn't even know how to use cl.exe to even determine with compiler it is. Maybe not all the proper environment variables and paths are being set correctly when using the compiler. -- F On Tue, Sep 17, 2019, at 3:11 PM, Joao Pedro Abreu De Souza wrote: > Thanks, I'll check it out. > > The toolchain file, as is, can generate ninja builds that can be used to > generate a executable, but when I execute them, he say : > > ``` > -- The C compiler identification is unknown > -- The CXX compiler identification is unknown > -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual > Studio 12.0/VC/bin/amd64_x86/cl.exe > -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual > Studio 12.0/VC/bin/amd64_x86/cl.exe -- broken > CMake Error at C:/Program > Files/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message): > The C compiler > > "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64_x86/cl.exe" > > is not able to compile a simple test program. > > It fails with the following output: > > Change Dir: > C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp > > Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_0dfb4 && > [1/2] Building C object CMakeFiles\cmTC_0dfb4.dir\testCCompiler.c.obj > FAILED: CMakeFiles/cmTC_0dfb4.dir/testCCompiler.c.obj > "C:\PROGRA~2\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" -o > CMakeFiles\cmTC_0dfb4.dir\testCCompiler.c.obj -c testCCompiler.c > ninja: build stopped: subcommand failed. > > > > > > CMake will not be able to correctly generate this project. > Call Stack (most recent call first): > CMakeLists.txt:2 (project) > ``` > > Em ter, 17 de set de 2019 às 16:02, Juan Sanchez <juan.e.sanc...@gmail.com> > escreveu: >> From my brief research, it looks like the Microsoft version of CMake may >> have Ninja support. >> >> https://devblogs.microsoft.com/cppblog/cmake-support-in-visual-studio-whats-new-in-2017-15-3-update/ >> >> >> Regards, >> >> Juan >> >> On Tue, Sep 17, 2019 at 1:36 PM Joao Pedro Abreu De Souza >> <jp_ab...@id.uff.br> wrote: >>> So, only the Visual Studio generator use the Arch option? I try generate >>> ninja build, but cmake(3.15.3) and the answer was >>> >>> ``` >>> $ cmake -B build -S . -G "Ninja" -A Win32 >>> CMake Error at CMakeLists.txt:2 (project): >>> Generator >>> >>> Ninja >>> >>> does not support platform specification, but platform >>> >>> Win32 >>> >>> was specified. >>> >>> >>> CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage >>> CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage >>> -- Configuring incomplete, errors occurred! >>> See also >>> "C:/Users/jpabreu/Desktop/testCMAKE/build/CMakeFiles/CMakeOutput.log". >>> ``` >>> >>> Em ter, 17 de set de 2019 às 14:00, Juan Sanchez <juan.e.sanc...@gmail.com> >>> escreveu: >>>> Hello, >>>> >>>> My impression that targeting 32 bit depends on what generator you are >>>> using. >>>> https://cmake.org/cmake/help/git-stage/generator/Visual%20Studio%2015%202017.html >>>> >>>> It looks like cmake now has: >>>> * `cmake -G "Visual Studio 15 2017" -A Win32` >>>> * `cmake -G "Visual Studio 15 2017" -A x64` >>>> It used to be that the default target platform was Win32, and you had to >>>> specify Win64 in the generator string to target a 64 bit build. For >>>> example with Visual Studio 2015 >>>> >>>> https://cmake.org/cmake/help/git-stage/generator/Visual%20Studio%2014%202015.html >>>> >>>> For compatibility with CMake versions prior to 3.1, one may specify a >>>> target platform name optionally at the end of the generator name. This is >>>> supported only for: >>>> `Visual Studio 14 2015 Win64` >>>> Specify target platform `x64`. >>>> `Visual Studio 14 2015 ARM` >>>> Specify target platform `ARM`. >>>> >>>> >>>> Regards, >>>> >>>> Juan >>>> >>>> >>>> On Tue, Sep 17, 2019 at 7:18 AM Joao Pedro Abreu De Souza >>>> <jp_ab...@id.uff.br> wrote: >>>>> cl from visual studio 2017. >>>>> >>>>> Em ter, 17 de set de 2019 03:26, Stéphane Ancelot >>>>> <sance...@numalliance.com> escreveu: >>>>>> Hi, >>>>>> That first depends on which compiler you will use ? >>>>>> Regards, >>>>>> S.Ancelot >>>>>> Le 16/09/2019 à 22:32, Joao Pedro Abreu De Souza a écrit : >>>>>>> Hi guys. I am trying to generate,using cmake, a executable with target >>>>>>> Windows 32 bits using Windows 64 bits, but cannot find a standard >>>>>>> toolchain file (I find to Linux, to Android, but can't find to Windows >>>>>>> 32 bits) to build. Do you know some repository of toolchain files that >>>>>>> has Windows 32 bits from Windows 64 bits? Or maybe someone has a >>>>>>> standard toolchain file to this type of thing. >>>>>>> >>>>>>> Thanks in advance. >>>>>>> >>>>> -- >>>>> >>>>> Powered by www.kitware.com >>>>> >>>>> Please keep messages on-topic and check the CMake FAQ at: >>>>> http://www.cmake.org/Wiki/CMake_FAQ >>>>> >>>>> Kitware offers various services to support the CMake community. For more >>>>> information on each offering, please visit: >>>>> >>>>> CMake Support: http://cmake.org/cmake/help/support.html >>>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html >>>>> CMake Training Courses: http://cmake.org/cmake/help/training.html >>>>> >>>>> Visit other Kitware open-source projects at >>>>> http://www.kitware.com/opensource/opensource.html >>>>> >>>>> Follow this link to subscribe/unsubscribe: >>>>> https://cmake.org/mailman/listinfo/cmake > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake