I’m unable to compile a simple project Ninja. I’ve made a SSCCE to demonstrate the issue.
My command line is super basic:
cmake -S . -B build -G "Ninja" -DCMAKE_MAKE_PROGRAM=D:\foobar\ninja.exe
Here are the files contents:
- This is the CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(demo)
add_executable(demo)
target_sources(demo PRIVATE
main.cpp
demo.rc
)
- This is the RC file in question causing the havoc.
#include <winres.h>
// Little macro tricks this turn number defines into non-quoted strings
#define STRINGIZED_HELPER( a ) #a
#define STRINGIZED( a ) STRINGIZED_HELPER( a )
#define DEMO_VERSION_MAJOR 1
#define DEMO_VERSION_MINOR 2
#define DEMO_BRANCH_VERSION_LEVEL1 3
#define DEMO_BRANCH_VERSION_LEVEL2 4
#define DEMO_BRANCH "demo_shorty"
#define DEMO_VER_STR STRINGIZED(DEMO_VERSION_MAJOR) "," STRINGIZED(DEMO_VERSION_MINOR) "," STRINGIZED(DEMO_BRANCH_VERSION_LEVEL1) "," STRINGIZED(DEMO_BRANCH_VERSION_LEVEL2) "\0"
#define FILEVER DEMO_VERSION_MAJOR,DEMO_VERSION_MINOR,DEMO_BRANCH_VERSION_LEVEL1,DEMO_BRANCH_VERSION_LEVEL2
#define PRODUCTVER DEMO_VERSION_MAJOR,DEMO_VERSION_MINOR,DEMO_BRANCH_VERSION_LEVEL1,DEMO_BRANCH_VERSION_LEVEL2
#define VS_PACKAGE_FILEVER DEMO_VERSION_MAJOR,DEMO_VERSION_MINOR,DEMO_BRANCH_VERSION_LEVEL1,DEMO_BRANCH_VERSION_LEVEL2
#define VS_PACKAGE_PRODUCTVER DEMO_VERSION_MAJOR,DEMO_VERSION_MINOR,DEMO_BRANCH_VERSION_LEVEL1,DEMO_BRANCH_VERSION_LEVEL2
#define STRFILEVER DEMO_VER_STR
#define STRPRODUCTVER DEMO_VER_STR
#define VS_PACKAGE_STRFILEVER DEMO_VER_STR
#define VS_PACKAGE_STRPRODUCTVER DEMO_VER_STR
#define STRCOMPANYNAME L"Foobar Inc.\0"
#define STRCOPYRIGHT L"(C) 2015-2021 Foobar Inc. For internal use only.\0"
#define STRFILEDESCRIPTION L"DEMO " DEMO_BRANCH " ver " DEMO_VER_STR "\0"
#define STRPRODUCTNAME L"DEMO\0"
#define VS_PACKAGE_STRPRODUCTNAME L"DEMO\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FILEVER
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", STRCOMPANYNAME
VALUE "FileDescription", STRFILEDESCRIPTION
VALUE "FileVersion", DEMO_VER_STR
VALUE "LegalCopyright", STRCOPYRIGHT
VALUE "LegalTrademarks", "\0"
VALUE "ProductName", STRPRODUCTNAME
VALUE "ProductVersion", DEMO_BRANCH
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
- This is main.cpp
#include <stdio.h>
int main(int argc, char** argv) { return 0; }
And I run this in a VS 2019 command prompt yet it fails:
It seems to be unable to find the appropriate environment for the RC/MT: