Page 1 of 1
[Windows] Building project that includes CMake sub-projects always fails
Posted: Wed Dec 04, 2024 9:21 pm
by WohlstandFox
Hello!
It's a long while when problem was been found, but it happens on Windows exclusively: when trying to build any CMake project that has any sub-directory or "ExternalProject" added. Here is a simple project (it builds for Linux with ncurses, for 3DS, for Wii, for Wii U, and for Switch): https://github.com/Wohlstand/MixerXDemoPlayer (when clonning repo, don't forget also submodules!).
That happens, because for unknown reasons, all paths in the submodule's make file (no matter Ninja or GNU Make / MinGW Makefile generator is chosen) contains a mixture of path as with Windows native and MSyS's specific (it starts with MSyS's path, and then a connotated Windows native path, of course this is fully invalid path). And in result, the build fails because resulted makefile is corrupted.
On UNIX-like systems the build goes just fine (tested on Linux mainly).
Re: [Windows] Building project that includes CMake sub-projects always fails
Posted: Mon Dec 09, 2024 2:47 pm
by WohlstandFox
Some additional info: I also forgot to append if speak about CMake and MSyS environment: When using pure MSyS and the regular MinGW-w64 toolkit to build for Windows itself, the build goes flawless with my another larger project. Maybe take something from their side to ensure correct Make/Ninja-build file?
Re: [Windows] Building project that includes CMake sub-projects always fails
Posted: Tue Dec 10, 2024 9:36 pm
by WinterMute
This appears to be some problem with msys2 cmake and Makefiles with your project. I'm not sure how to fix it but it isn't something on our side, the msys2 bundle we supply has only minor differences from "pure msys2" relating to the included repo dbs and a mountpoint so the msys2 shell sees the devkitPro folder as /opt/devkitpro for compatibility with linux & macOS. You can, of course, simply add the dkP repos to a standard msys2 install and have things just work generally but the same issue happens with your project if you use -G"Unix Makefiles" but installing ninja (pacman -S ninja) should get cmake to use ninja as the build system but you can also use -GNinja to make sure. This works for us on windows with your project.