find_library: 3.25.0 finds GNU-ABI libfoo.a libraries when targeting MSVC ABI
Original Subject: include files mixed between msys64/mingw64 and VS 2019 with latest cmake-3.25.0 when building drogon C++ http server
Hi! I'm getting weird compile errors when building https://github.com/drogonframework/drogon (cloned from git) with latest cmake-3.25.0.
Platform : Windows 10
Build env :
- compiler: VS 2019
- shell: ConEmu + msys64 bash.exe
- mingw64 gcc is also installed on this dev box, but it should not be used in this project. cmake correctly detects VS 2019 (i.e. dump it in standard output), chooses the VS build chain and generates .sln/.vcxproj files for VS.
The project always builded fine fo months, until I upgraded cmake from 3.24.3 to to 3.25.0 yesterday.
Now when compiling the "drogon" project (drogon solution has many projects), I get mixed include files from VS2019 and mingw64 in the compiler output ! e.g. :
Build started...
1>------ Build started: Project: drogon, Configuration: Release x64 ------
1>AOPAdvice.cc
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(351,22): error C2182: '__security_check_cookie': illegal use of type 'void'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(351,51): error C2065: 'uintptr_t': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(351,61): error C2146: syntax error: missing ')' before identifier '_StackCookie'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(352,43): error C2182: '__report_gsfailure': illegal use of type 'void'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(352,43): error C3829: 'noreturn' may only be applied to a function
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(352,67): error C2065: 'uintptr_t': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(352,77): error C2146: syntax error: missing ')' before identifier '_StackCookie'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(356,18): error C2146: syntax error: missing ';' before identifier '__security_cookie'
1>C:/dev/msys64/mingw64/include\corecrt.h(75,53): error C2378: 'uintptr_t': redefinition; symbol cannot be overloaded with a typedef
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(356): message : see declaration of 'uintptr_t'
1>C:/dev/msys64/mingw64/include\stddef.h(26,28): error C2143: syntax error: missing ';' before '__cdecl'
1>C:/dev/msys64/mingw64/include\stddef.h(26,18): error C2370: 'uintptr_t': redefinition; different storage class
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\vcruntime.h(356): message : see declaration of 'uintptr_t'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include\cstdint(52,13): error C2874: using-declaration causes a multiple declaration of 'uintptr_t'
1>C:/dev/msys64/mingw64/include\corecrt.h(75): message : see declaration of 'uintptr_t'
1>C:/dev/msys64/mingw64/include\math.h(209,5): error C2065: '__asm__': undeclared identifier
1>C:/dev/msys64/mingw64/include\math.h(209,13): error C2146: syntax error: missing ';' before identifier '__volatile__'
1>C:/dev/msys64/mingw64/include\math.h(209,35): error C2143: syntax error: missing ')' before ':'
1>C:/dev/msys64/mingw64/include\math.h(209,13): error C3861: '__volatile__': identifier not found
1>C:/dev/msys64/mingw64/include\math.h(209,35): error C2143: syntax error: missing ';' before ':'
1>C:/dev/msys64/mingw64/include\math.h(209,35): error C2059: syntax error: ':'
1>C:/dev/msys64/mingw64/include\math.h(209,57): error C2059: syntax error: ')'
1>C:/dev/msys64/mingw64/include\math.h(220,5): error C2065: '__asm__': undeclared identifier
1>C:/dev/msys64/mingw64/include\math.h(220,13): error C2146: syntax error: missing ';' before identifier '__volatile__'
1>C:/dev/msys64/mingw64/include\math.h(220,35): error C2143: syntax error: missing ')' before ':flag_ci:
...
...
-
Of course I removed CMakeCache.txt and relaunched cmake to reconfigur the VS solution after upgrading to 3.25.0.
-
Above log is from within VS 2019 (Build Solution) but I'm getting the same errors when building in bash + cmake command "cmake --build ~/path/to/git/drogon --config Release".
-
If I revert to 3.24.3 everything build fine again (so I reverted for now).
Not sure what's going on here.