Mark
Mark

Reputation: 5152

Compile CMake based project with minGW

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?

Upvotes: 0

Views: 3487

Answers (2)

partyd
partyd

Reputation: 1043

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

Upvotes: 1

besc
besc

Reputation: 2647

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.

Upvotes: 2

Related Questions