Today I began cleaning up the cmake code I spend 8 hours yesterday research flags to remove annoying settings created by cmake internally. This is barely fun for me, so let’s get into it.
Platform/WASI to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that file on discourse.cmake.org.
I am using clang -target=wasm32-wasi
From an outsider’s perspective (I am new to cmake). It would appear that both companies involved in the building of my project refuse to work together (cmake and clang). There are pull requests to fix issues that I’ve run in to that are closed or ignored. Either company could make it easier to develop with these tools and from my perspective, compared to Makefile, they are awful. So I’m going to get really specific because it will help me get it off my chest, and probably I’ll be ignored because more people can’t handle this level of truth.
clang: error: unsupported option ‘-arch’ for target ‘wasm32-wasi’
What is cmake doing to help me with this error? Nothing. To get rid of this, I have to fool cmake into an unrecognized architecture via:
set(CMAKE_SYSTEM_PROCESSOR “v8”)
This error could easily be fixed by either company, either cmake adds obvious support than googling “cmake wasi” or “cmake emscripten” or “cmake wasm”. But those results are nearly fruitless. It’s also impossible to find the part of clang that generates that error because of how their compile flags are processed otherwise I would link directly to source code in clang to ignore it. (Because cmake is adding it automatically, you take partial fault in my misery). But now someone from cmake will come along and tell me that supporting the clang project is also out of scope and my issue is nullified, right?
clang++: warning: argument unused during compilation: ‘-dynamiclib’ [-Wunused-command-line-argument]
clang++: warning: argument unused during compilation: ‘-install_name @rpath/jampgamev8.wasm’ [-Wunused-command-line-argument]
wasm-ld: error: unknown argument: -headerpad_max_install_names
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
m
Okay, why is my wasm generator include Darwin platform code? Because of CMakeSystem.cmake. What is this file? Remember I’m new? Why do I have to delete this file completely in order to get cmake to recognize that I’ve now set(CMAKE_CROSSCOMPILING ON)?
Why isn’t CMakeSystem.cmake regenerated when set(CMAKE_HOST_SYSTEM_NAME v8) changes?
These are very basic usages, and I’m starting from a working project. I can’t even believe that somebody would start using cmake from a project that hasn’t already been successfully compiled by cmake, this would be hell compared to Makefile.
It’s almost like the people who make cmake have never asked somebody how to use the thing that the made. In college, I took a user interfaces class where we actually set up a camera over somebody’s shoulder and watched them use our software to learn what pitfalls our software has that have no solution yet.
This is the pitfall of cmake. When I google “cmake set platform wasm” it should come back with a definitive answer that works on all cmake files ever written. Instead that query has led me down a rabbit hole that has taught me to hate cmake and all the stupid little features cmake thinks it’s doing for me, but it’s actually getting in the way.
So no. I will not post my CopyOfCMakeCache.txt unless I 1) get the discourse I deserve, and 2) somebody links me to solutions that would have made all this go away, and I’ve learned something new about cmake that doesn’t make me hate it.
I am porting Jedi Knights Academy to the web.