CSharp language specification is not platform agnostic
So I have a combination of C++ and C# targets in my CMake project. I specify the project command like so:
project( FrontEnd LANGUAGES C CXX CSharp )
When I run using Android as a platform (cross compile), I get:
CMake Error at /usr/local/share/cmake-3.12/Modules/CMakeDetermineCSharpCompiler.cmake:5 (message):
C# is currently only supported for Microsoft Visual Studio 2010 and later.
However, if I remove the CSharp
flag from project()
, then I get errors on the Windows platform where C# targets are actually created (errors occur on generation step):
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_DEBUG
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_RELEASE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_MINSIZEREL
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_RELWITHDEBINFO
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_DEBUG
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_RELEASE
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_MINSIZEREL
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CSharp_FLAGS_RELWITHDEBINFO
So there's a catch 22 here: I can't conditionally call project()
because until you call it, CMake API isn't fully deterministic/reliable/usable. And I can't have CSharp
on other non-Windows platforms. What's the solution here?