toolchain file - cross-compiling windows-amd64->windows-x86

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Stéphane Ancelot

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Albrecht Schlosser
On 9/17/19 2:17 PM Joao Pedro Abreu De Souza wrote:

> cl from visual studio 2017.
>
> Em ter, 17 de set de 2019 03:26, Stéphane Ancelot
> <[hidden email] <mailto:[hidden email]>> 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.

Well, I don't have a toolchain file for your compiler, but maybe my
toolchain file for cross compilation under Linux for Windows (64-bit)
can help. You'll need to adjust compiler and paths...

$ cat mingw-w64_toolchain.cmake
# CMake Toolchain File for MinGW-w64 (64-bit) Cross Compilation

# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)

# which tools to use
set(CMAKE_C_COMPILER   /usr/bin/x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)

# here is where the target environment located
set(CMAKE_FIND_ROOT_PATH  /usr/x86_64-w64-mingw32)

# adjust the default behavior of the FIND_XXX() commands:

# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_INSTALL_PREFIX ${CMAKE_FIND_ROOT_PATH}/usr CACHE FILEPATH
    "install path prefix")

# initialize required linker flags
set(CMAKE_EXE_LINKER_FLAGS_INIT "-static-libgcc -static-libstdc++")

# end of toolchain file

HTH. YMMV
--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Juan Sanchez
In reply to this post by Joao Pedro Abreu De Souza
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

guymac

AFAIK you can set the generator in a CMakeSettings.json file if you are using MSVC.

https://docs.microsoft.com/en-us/cpp/build/cmakesettings-reference?view=vs-2019

On 9/17/2019 10:00 AM, Juan Sanchez wrote:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
In reply to this post by Juan Sanchez
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 <[hidden email]> escreveu:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Juan Sanchez
From my brief research, it looks like the Microsoft version of CMake may have Ninja support.


Regards,

Juan

On Tue, Sep 17, 2019 at 1:36 PM Joao Pedro Abreu De Souza <[hidden email]> 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 <[hidden email]> escreveu:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
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 <[hidden email]> escreveu:
From my brief research, it looks like the Microsoft version of CMake may have Ninja support.


Regards,

Juan

On Tue, Sep 17, 2019 at 1:36 PM Joao Pedro Abreu De Souza <[hidden email]> 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 <[hidden email]> escreveu:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

fdk17
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.

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 <[hidden email]> escreveu:
From my brief research, it looks like the Microsoft version of CMake may have Ninja support.


Regards,

Juan

On Tue, Sep 17, 2019 at 1:36 PM Joao Pedro Abreu De Souza <[hidden email]> 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 <[hidden email]> escreveu:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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:


Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
-- 

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
Well, the Visual Studio Generator alone is not a option because the repository has a actual build system(a bunch of bat files that call a python script that generate ninja files).
We want to change to cmake, and now we don't use Visual Studio a lot. Most of time, we only need their compiler and linker.

Well, Thanks all for the attention, sorry about the time wasted. I will continue to search to exactly options and, in case of sucess, mail here again.
Great day to all of you.

Em ter, 17 de set de 2019 às 16:56, fdk17 <[hidden email]> escreveu:
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.

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 <[hidden email]> escreveu:
From my brief research, it looks like the Microsoft version of CMake may have Ninja support.


Regards,

Juan

On Tue, Sep 17, 2019 at 1:36 PM Joao Pedro Abreu De Souza <[hidden email]> 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 <[hidden email]> escreveu:
Hello,

My impression that targeting 32 bit depends on what generator you are using.

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


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 <[hidden email]> wrote:
cl from visual studio 2017.

Em ter, 17 de set de 2019 03:26, Stéphane Ancelot <[hidden email]> 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:


Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
-- 

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:


Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:


--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Eric Dönges
In reply to this post by fdk17

We use ninja for building on Windows. Our toolchain file for the MSVC compiler is really simple (this is for MSVC 18.0, 32 bits):

--- SNIP ---

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_VERSION 1)

# Microsoft MSVC compiler
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)

# Unfortunatly CMake doesn't seem to know anything about the MSVC compiler,
# so tell CMake that cl.exe supports C99
set(CMAKE_C_COMPILE_FEATURES c_std_99)

# If Visual Studio is selected as generator, only allow VS 2013
if(CMAKE_GENERATOR MATCHES "Visual Studio")
  if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 12 2013")
    message(FATAL_ERROR "Visual Studio generator requires Visual Studio 12 2013"
      " for this configuration")
  else()
    # Enable parallel builds for Visual Studio Projects with the /MP flag
    set(_MP_FLAG "/MP")
  endif()
endif()

set(CMAKE_C_FLAGS_INIT   "/arch:SSE2 ${_MP_FLAG} /EHsc")
set(CMAKE_CXX_FLAGS_INIT "/arch:SSE2 ${_MP_FLAG}")

--- SNIP ---

However, there is a major snag (naturally, since we're talking about Windows here) - in order for the Microsoft compiler to work from the command line, you need to set the correct environment, and CMake doesn't really give you a good way to do this. You can set environment variables from CMake, but as the documentation says "This command affects only the current CMake process, not the process from which CMake was called, nor the system environment at large, nor the environment of subsequent build or test processes.".

The solution we use is instead of calling cmake directly, we call a Perl script that sets up the environment correctly and then calls cmake for configuration or building. An alternative solution would be to write a batch script wrapper for cl.exe, something like.

@ECHO OFF
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
cl.exe %*

and then set this batch script as the C and C++ compiler in CMake (note that this is untested - I think it should work, but it may need some extra work).

With kind regards,
Eric

Am 17.09.19 um 21:46 schrieb fdk17:
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.

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
--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo

--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
Cool. I try using this toolchain in a toy project, just to test, and execute the cmake inside cross-compiling x64_x86 from visual studio 2017 and all work as expected, except the linking from ninja, that break because cannot find printf.
Is absolutely cool, better than my last toolchain. Do you know how Can I link with libc from visual studio 2013(that was your example)? From location on 2013, the 2017 can be deduced, I think.

To make clear, when I said how to link with libc, is literally the path that I don't know kkkk, I know that must use libpath(or set LIB env variable) with the path, but what path? kkk

Em qua, 18 de set de 2019 às 02:50, Eric Doenges <[hidden email]> escreveu:

We use ninja for building on Windows. Our toolchain file for the MSVC compiler is really simple (this is for MSVC 18.0, 32 bits):

--- SNIP ---

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_VERSION 1)

# Microsoft MSVC compiler
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)

# Unfortunatly CMake doesn't seem to know anything about the MSVC compiler,
# so tell CMake that cl.exe supports C99
set(CMAKE_C_COMPILE_FEATURES c_std_99)

# If Visual Studio is selected as generator, only allow VS 2013
if(CMAKE_GENERATOR MATCHES "Visual Studio")
  if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 12 2013")
    message(FATAL_ERROR "Visual Studio generator requires Visual Studio 12 2013"
      " for this configuration")
  else()
    # Enable parallel builds for Visual Studio Projects with the /MP flag
    set(_MP_FLAG "/MP")
  endif()
endif()

set(CMAKE_C_FLAGS_INIT   "/arch:SSE2 ${_MP_FLAG} /EHsc")
set(CMAKE_CXX_FLAGS_INIT "/arch:SSE2 ${_MP_FLAG}")

--- SNIP ---

However, there is a major snag (naturally, since we're talking about Windows here) - in order for the Microsoft compiler to work from the command line, you need to set the correct environment, and CMake doesn't really give you a good way to do this. You can set environment variables from CMake, but as the documentation says "This command affects only the current CMake process, not the process from which CMake was called, nor the system environment at large, nor the environment of subsequent build or test processes.".

The solution we use is instead of calling cmake directly, we call a Perl script that sets up the environment correctly and then calls cmake for configuration or building. An alternative solution would be to write a batch script wrapper for cl.exe, something like.

@ECHO OFF
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
cl.exe %*

and then set this batch script as the C and C++ compiler in CMake (note that this is untested - I think it should work, but it may need some extra work).

With kind regards,
Eric

Am 17.09.19 um 21:46 schrieb fdk17:
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.

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
--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo
--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Eric Dönges

If the environment is set up correctly, the MSVC tools should be able to find the correct versions of the runtime libraries automatically. If you are using the wrapper script approach, the problem is most likely that when using MSVC, linking is done by calling the linker directly instead of indirectly via the compiler driver (as is common on Unix-like systems). So you also need a wrapper for link.exe that sets up the environment, and tell CMake to use that by setting CMAKE_LINKER to the name of the wrapper script.

With kind regards,
Eric

Am 18.09.19 um 18:39 schrieb Joao Pedro Abreu De Souza:
Cool. I try using this toolchain in a toy project, just to test, and execute the cmake inside cross-compiling x64_x86 from visual studio 2017 and all work as expected, except the linking from ninja, that break because cannot find printf.
Is absolutely cool, better than my last toolchain. Do you know how Can I link with libc from visual studio 2013(that was your example)? From location on 2013, the 2017 can be deduced, I think.

To make clear, when I said how to link with libc, is literally the path that I don't know kkkk, I know that must use libpath(or set LIB env variable) with the path, but what path? kkk

Em qua, 18 de set de 2019 às 02:50, Eric Doenges <[hidden email]> escreveu:

We use ninja for building on Windows. Our toolchain file for the MSVC compiler is really simple (this is for MSVC 18.0, 32 bits):

--- SNIP ---

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_VERSION 1)

# Microsoft MSVC compiler
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)

# Unfortunatly CMake doesn't seem to know anything about the MSVC compiler,
# so tell CMake that cl.exe supports C99
set(CMAKE_C_COMPILE_FEATURES c_std_99)

# If Visual Studio is selected as generator, only allow VS 2013
if(CMAKE_GENERATOR MATCHES "Visual Studio")
  if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 12 2013")
    message(FATAL_ERROR "Visual Studio generator requires Visual Studio 12 2013"
      " for this configuration")
  else()
    # Enable parallel builds for Visual Studio Projects with the /MP flag
    set(_MP_FLAG "/MP")
  endif()
endif()

set(CMAKE_C_FLAGS_INIT   "/arch:SSE2 ${_MP_FLAG} /EHsc")
set(CMAKE_CXX_FLAGS_INIT "/arch:SSE2 ${_MP_FLAG}")

--- SNIP ---

However, there is a major snag (naturally, since we're talking about Windows here) - in order for the Microsoft compiler to work from the command line, you need to set the correct environment, and CMake doesn't really give you a good way to do this. You can set environment variables from CMake, but as the documentation says "This command affects only the current CMake process, not the process from which CMake was called, nor the system environment at large, nor the environment of subsequent build or test processes.".

The solution we use is instead of calling cmake directly, we call a Perl script that sets up the environment correctly and then calls cmake for configuration or building. An alternative solution would be to write a batch script wrapper for cl.exe, something like.

@ECHO OFF
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
cl.exe %*

and then set this batch script as the C and C++ compiler in CMake (note that this is untested - I think it should work, but it may need some extra work).

With kind regards,
Eric

Am 17.09.19 um 21:46 schrieb fdk17:
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.

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
--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo
--

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
--

Dr. Eric Dönges
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
[hidden email] | Tel: +49 89 457 695-0 | www.mvtec.com

Find our privacy policy here.

 Sign up for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

 

MVTec Software GmbH Logo

--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Gonzalo Garramuño
In reply to this post by fdk17


El 17/9/19 a las 16:46, fdk17 escribió:

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.

I use it just like that.  I open a .bat file that calls vsvars with the right settings and then calls msys bash. Find it below:


@echo off

call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" amd64 8.1
C:
C:\MinGW\msys\1.0\msys.bat -rxvt

Then I call cmake and ninja with a bash script (both are in the bash PATH).  Find it attached.


--

Gonzalo Garramuño

--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Joao Pedro Abreu De Souza
Now, with this toolchain file: 
-----start of toolchain file-------
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR "x86")
set(CMAKE_SYSTEM_VERSION 1)

# Microsoft MSVC compiler
#set(CMAKE_C_COMPILER cl.exe)
#set(CMAKE_CXX_COMPILER cl.exe)

set(CMAKE_C_COMPILER "${CMAKE_CURRENT_SOURCE_DIR}/ninja-core-lib/toolchains/cl.bat")
set(CMAKE_CXX_COMPILER "${CMAKE_C_COMPILER}")

# Unfortunatly CMake doesn't seem to know anything about the MSVC compiler,
# so tell CMake that cl.exe supports C99
set(CMAKE_C_COMPILE_FEATURES c_std_99)


set(CMAKE_C_FLAGS_INIT   "/arch:SSE2 ${_MP_FLAG} /EHsc")
set(CMAKE_CXX_FLAGS_INIT "/arch:SSE2 ${_MP_FLAG}")



#set(CMAKE_STATIC_LINKER link.exe)
#set(CMAKE_LINKER link.exe)
#set(CMAKE_SHARED_LINKER link.exe)

set(CMAKE_STATIC_LINKER "${CMAKE_CURRENT_SOURCE_DIR}/ninja-core-lib/toolchains/link.bat")
set(CMAKE_LINKER ${CMAKE_STATIC_LINKER})
set(CMAKE_SHARED_LINKER ${CMAKE_STATIC_LINKER})


set(CMAKE_AR ${CMAKE_LINKER})

set(CMAKE_C_COMPILER_ID "porquePreciseiDeUmBat")
-----stop of toolchain file-------  

using this cl.bat
----start of cl.bat---------
pushd
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
popd
cl.exe %*
----stop of cl.bat---------  

and link.bat in the same spirit but with link.exe instead of cl.exe, I can execute cmake, ninja, but the main.exe don't are on build/src/main


When I look on CMakeError.log on build directory, can look

-------start of CMakeError.log--------------------------
C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles>more CMakeError.log
Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".

Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>pushd

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'
Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>pushd

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'
Detecting C compiler ABI info failed to compile 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_8a08d && [1/2] Building C object CMakeFiles\cmTC_8a08d.dir\CMakeCCompilerABI.c.obj

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>pushd

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'
[2/2] Linking C executable cmTC_8a08d.exe

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>pushd

C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'


Cannot copy output executable
  ''
to destination specified by COPY_FILE:
  'C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CMakeDetermineCompilerABI_C.bin'
Unable to find the executable at any of:
  C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/cmTC_8a08d.exe
  C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/Debug/cmTC_8a08d.exe
  C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/Development/cmTC_8a08d.exe
-------stop of CMakeError.log-------------------------- 

I am not understanding the last error. All this files are my (are under Users/jpabreu), so I don't think that may be permission problems.

Em qui, 19 de set de 2019 às 14:02, Gonzalo Garramuño <[hidden email]> escreveu:


El 17/9/19 a las 16:46, fdk17 escribió:

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.

I use it just like that.  I open a .bat file that calls vsvars with the right settings and then calls msys bash. Find it below:


@echo off

call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" amd64 8.1
C:
C:\MinGW\msys\1.0\msys.bat -rxvt

Then I call cmake and ninja with a bash script (both are in the bash PATH).  Find it attached.


--

Gonzalo Garramuño
--

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
Reply | Threaded
Open this post in threaded view
|

Re: toolchain file - cross-compiling windows-amd64->windows-x86

Juan Sanchez
Hello,

Perhaps you can start by not using the .bat scripts and using the .exe
instead.  You can run cmake from a visual studio environment, and
instead of invoking a visual studio environment for each command.

And to build from your script:
cmake --build .

Regards,

Juan


On 9/19/19 12:59 PM, Joao Pedro Abreu De Souza wrote:

> Now, with this toolchain file:
> -----start of toolchain file-------
> set(CMAKE_SYSTEM_NAME Windows)
> set(CMAKE_SYSTEM_PROCESSOR "x86")
> set(CMAKE_SYSTEM_VERSION 1)
>
> # Microsoft MSVC compiler
> #set(CMAKE_C_COMPILER cl.exe)
> #set(CMAKE_CXX_COMPILER cl.exe)
>
> set(CMAKE_C_COMPILER
> "${CMAKE_CURRENT_SOURCE_DIR}/ninja-core-lib/toolchains/cl.bat")
> set(CMAKE_CXX_COMPILER "${CMAKE_C_COMPILER}")
>
> # Unfortunatly CMake doesn't seem to know anything about the MSVC compiler,
> # so tell CMake that cl.exe supports C99
> set(CMAKE_C_COMPILE_FEATURES c_std_99)
>
>
> set(CMAKE_C_FLAGS_INIT   "/arch:SSE2 ${_MP_FLAG} /EHsc")
> set(CMAKE_CXX_FLAGS_INIT "/arch:SSE2 ${_MP_FLAG}")
>
>
>
> #set(CMAKE_STATIC_LINKER link.exe)
> #set(CMAKE_LINKER link.exe)
> #set(CMAKE_SHARED_LINKER link.exe)
>
> set(CMAKE_STATIC_LINKER
> "${CMAKE_CURRENT_SOURCE_DIR}/ninja-core-lib/toolchains/link.bat")
> set(CMAKE_LINKER ${CMAKE_STATIC_LINKER})
> set(CMAKE_SHARED_LINKER ${CMAKE_STATIC_LINKER})
>
>
> set(CMAKE_AR ${CMAKE_LINKER})
>
> set(CMAKE_C_COMPILER_ID "porquePreciseiDeUmBat")
> -----stop of toolchain file-------
>
> using this cl.bat
> ----start of cl.bat---------
> pushd
> "C:/Program Files (x86)/Microsoft Visual
> Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
> popd
> cl.exe %*
> ----stop of cl.bat---------
>
> and link.bat in the same spirit but with link.exe instead of cl.exe, I
> can execute cmake, ninja, but the main.exe don't are on build/src/main
>
>
> When I look on CMakeError.log on build directory, can look
>
> -------start of CMakeError.log--------------------------
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles>more
> CMakeError.log
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Compilation of the C compiler identification source "CMakeCCompilerId.c"
> did not produce an executable in
> "C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CompilerIdC".
>
> Checking whether the C compiler is IAR using "" did not match "IAR .+
> Compiler":
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>pushd
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>"C:/Program
> Files (x86)/Microsoft Visual
> Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
> **********************************************************************
> ** Visual Studio 2017 Developer Command Prompt v15.9.16
> ** Copyright (c) 2017 Microsoft Corporation
> **********************************************************************
> [vcvarsall.bat] Environment initialized for: 'x64_x86'
> Checking whether the C compiler is IAR using "" did not match "IAR .+
> Compiler":
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>pushd
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\3.15.3\CompilerIdC>"C:/Program
> Files (x86)/Microsoft Visual
> Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
> **********************************************************************
> ** Visual Studio 2017 Developer Command Prompt v15.9.16
> ** Copyright (c) 2017 Microsoft Corporation
> **********************************************************************
> [vcvarsall.bat] Environment initialized for: 'x64_x86'
> Detecting C compiler ABI info failed to compile 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_8a08d
> && [1/2] Building C object CMakeFiles\cmTC_8a08d.dir\CMakeCCompilerABI.c.obj
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>pushd
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>"C:/Program
> Files (x86)/Microsoft Visual
> Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
> **********************************************************************
> ** Visual Studio 2017 Developer Command Prompt v15.9.16
> ** Copyright (c) 2017 Microsoft Corporation
> **********************************************************************
> [vcvarsall.bat] Environment initialized for: 'x64_x86'
> [2/2] Linking C executable cmTC_8a08d.exe
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>pushd
>
> C:\Users\jpabreu\Desktop\testCMAKE\build_Win32_normal\CMakeFiles\CMakeTmp>"C:/Program
> Files (x86)/Microsoft Visual
> Studio/2017/Community/VC/Auxiliary/Build/vcvarsamd64_x86.bat"
> **********************************************************************
> ** Visual Studio 2017 Developer Command Prompt v15.9.16
> ** Copyright (c) 2017 Microsoft Corporation
> **********************************************************************
> [vcvarsall.bat] Environment initialized for: 'x64_x86'
>
>
> Cannot copy output executable
>    ''
> to destination specified by COPY_FILE:
>    
> 'C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/3.15.3/CMakeDetermineCompilerABI_C.bin'
> Unable to find the executable at any of:
>    
> C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/cmTC_8a08d.exe
>    
> C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/Debug/cmTC_8a08d.exe
>    
> C:/Users/jpabreu/Desktop/testCMAKE/build_Win32_normal/CMakeFiles/CMakeTmp/Development/cmTC_8a08d.exe
> -------stop of CMakeError.log--------------------------
>
> I am not understanding the last error. All this files are my (are under
> Users/jpabreu), so I don't think that may be permission problems.
>
> Em qui, 19 de set de 2019 às 14:02, Gonzalo Garramuño
> <[hidden email] <mailto:[hidden email]>> escreveu:
>
>
>     El 17/9/19 a las 16:46, fdk17 escribió:
>>
>>     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.
>
>     I use it just like that.  I open a .bat file that calls vsvars with
>     the right settings and then calls msys bash. Find it below:
>
>
>     @echo off
>
>     call "C:/Program Files (x86)/Microsoft Visual Studio
>     14.0/VC/vcvarsall.bat" amd64 8.1
>     C:
>     C:\MinGW\msys\1.0\msys.bat -rxvt
>
>     Then I call cmake and ninja with a bash script (both are in the bash
>     PATH).  Find it attached.
>
>
>     --
>
>     Gonzalo Garramuño
>
>     --
>
>     Powered by www.kitware.com <http://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