[SOLVED] Building a self-contained unix executable (CMake)?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
mangoesfruit
Posts: 19
Joined: Sat Aug 21, 2021 11:16 pm

Re: Building a self-contained unix executable (CMake)?

Post by mangoesfruit »

Than
Last edited by mangoesfruit on Tue Aug 31, 2021 4:47 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9646
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Building a self-contained unix executable (CMake)?

Post by CuteAlien »

If you want to use system libraries then find_library is good because it can automatically search for the library in the "usual" places where libraries are installed. Which can be different depending on OS - so it allows creating CMakefiles which work for people who may compile a project on some completely different system.

But if you build libraries yourself you have to directly set the path as CMake can't know where you put them (as you can put them anywhere you like). So link_directories is needed in that case. If you set find_library it would go back to searching for system libraries first, which is not what you want. But it also means if you ever open source the project or pass the source on to other people you have to put the libraries you used into your project as well or other people will have a harder time compiling it.
It's something Unix people frown upon a bit - especially distributions. But personally I prefer working that way a lot as it tends to make maintenance rather easier as you know exactly which library versions you used to get your project running. There's more advantages/disadvantages, but in short - for your case find_library is probably the best.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mangoesfruit
Posts: 19
Joined: Sat Aug 21, 2021 11:16 pm

Re: Building a self-contained unix executable (CMake)?

Post by mangoesfruit »

thanks f
Last edited by mangoesfruit on Tue Aug 31, 2021 4:47 pm, edited 1 time in total.
mangoesfruit
Posts: 19
Joined: Sat Aug 21, 2021 11:16 pm

Re: Building a self-contained unix executable (CMake)?

Post by mangoesfruit »

I have trie
Last edited by mangoesfruit on Tue Aug 31, 2021 4:46 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9646
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [SOLVED] Building a self-contained unix executable (CMake)?

Post by CuteAlien »

No problem, nice it works now.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply