I’m trying to include libssh into my project via add_subdirectory(…) with cmake 3.24.2 using the Visual Studio 2019 generator. And all the calls to check_symbol_exists fail.
My configure cmd is:
cmake -G "Visual Studio 16 2019" -A x64 ..
When I look at why it’s failing, my CMakeFiles\CMakeError.log file contains this sort of thing:
Determining if the vsnprintf exist failed with the following output:
Change Dir: C:/Code/FileTeePee/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_30e9e.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: cmTC_30e9e.vcxproj
File C:/Code/FileTeePee/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <stdio.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef vsnprintf
return ((int*)(&vsnprintf))[argc];
#else
(void)argc;
return 0;
#endif
}
I think this is a cmake bug. As I’m not doing anything weird here… this should be working.