tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.85k stars 320 forks source link

cmake doesn't work, produces "unknown argument" errors #315

Closed realnc closed 2 years ago

realnc commented 2 years ago

After successfully installing osxcross, I can't get anything that uses cmake to build. Configuration succeeds, but building fails with either:

CMake Error: Unknown argument -j

Or:

CMake Error: Unknown argument --build

Example cmake invocation:

x86_64-apple-darwin21.1-cmake --build . --config Release --target install -j `nproc`
tpoechtrager commented 2 years ago

That's not how cmake works. 🙂

x86_64-apple-darwin21.1-cmake . -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX:PATH=target
make -j ...
realnc commented 2 years ago

That's not how cmake works. slightly_smiling_face

x86_64-apple-darwin21.1-cmake . -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX:PATH=target
make -j ...

That only works for makefiles. When using the cmake Ninja generator, or the Visual Studio one, or the XCode project one, then this doesn't work.

This is why cmake has a --build option. However, I found the issue. Since cmake 3.20, -D prevents build arguments from working. Previously, they would be silently ignored.

I'll clone the repo and push a fix shortly.

tpoechtrager commented 2 years ago

You are right. Thanks for the PR. 👍

realnc commented 2 years ago

Thanks! :)