0
votes

I want to use SignalR in a Windows project that is compiled with MinGW (MSYS2). As far as I know I cannot link against a library (dll) compiled with another compiler (i.e. VC++).

Hence, I need to compile SignalR with MinGW. Here the repository:

https://github.com/aspnet/SignalR-Client-Cpp

The project is based on CMake rather than a standard Makefile. This is what I did:

Trying to compile the Cpp Rest SDK as described here:

https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux

leads to this output:

$ cmake .. -DCMAKE_BUILD_TYPE=Release -- Building for: Visual Studio 15 2017 -- The C compiler identification is MSVC 19.10.25019.0 -- The CXX compiler identification is MSVC 19.10.25019.0 -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe -- works

I'm afraid it's still using the MSVC compiler so the output binaries won't be compatible with my application.

How should I compile those libraries?

2
cmake has the CC and CXX environment variables (at least on linux). you should change these to your mingw. there should be command line flags that allow this as well. otherwise see ccmake (again in linux, but maybe in windows as well) that allows you to change many variables and flags and so on. go into advanced mode if necessaryjonas_toth

2 Answers

2
votes

CMake does not build anything itself. Rather it generates the configuration files for make, MSBuild, Ninja, etc. Each platform has its default generator. For Windows, that is Visual Studio/NMake.

You can select a generator manually with CMake’s -G option. Some generator names contain spaces. Make sure to put quotes around those.

1
votes

I am not familiar with the mingw tool chain but in cygwin it includes its own build of cmake for which you would use to generate the build system for your library. You are using the pre-compiled Windows binary which is going to detect Visual Studio.

If mingw doesnt include a prebuilt cmake I would download the source and compile it within mingw and then use that cmake binary to generate the build system of SignalR.

Download from: http://www.cmake.org/download/ And build it by:

    ./bootstrap
    make      
    make install