Thanks for your valuable feedback. First, let me set this straight before attempting to answer your question. The current build scripts are not perfect yet and have rooms for improvement. As Urho3D project now attracts more and more talented peoples, you or anyone with CMake expertise are welcome to contribute to improve them. Our CMake build scripts have come a long way through slow incremental changes rather than one big revamp to where they are today and they should continue to change. There was a time “Urho3D” does not even exist as a CMake library target in the project.
Now, I will try to answer your questions:
[ul]
[li]URHO3D_INCLUDE_DIRS vs URHO3D_INCLUDE_DIR
By sheer luck when I wrote the first FindXXX CMake module for the project, I was following a bad template. The unconventional variable name unfortunately stays and spreads. I will correct this but this will break downstream projects using Urho3D as external library.
[/li]
[li]Urho3D-CMake-magic module
The module was created soon after we have created the “Urho3D” library target and for the first time we have the context of “library user”. The module came to its being as an afterthought and as a response to a quick discussion in the former Urho3D forum quite similar to this discussion. Its goal is to share those reusable macros to library users. Those macros were in the main Urho3D project locked away from library user otherwise. Those 700-line script should always be there whether we chose to share it to downstream projects or not. It may not the best or conventional way to do it but it was the quickest way to get it done with the least impact to the rest of the build scripts at that time.
There is nothing “magical” about it. I wonder how many developers out there would stop for a few minutes like myself just to find a good name for their creation (and learn to regret the chosen name later ). Anyway, it was named after “magic” because of someone’s comment in the forum back then (hint: it was quite similar to the comment above).
[/li]
[li]FindUrho3D module
Granted, the whole setup is a little unorthodox but it gets the job done for all the use cases for FindUrho3D module in all the supported platforms. It can be used both internally by Urho3D project and externally by downstream projects. It can be used with Urho3D installed or just in its own build tree, although at the moment it does not use any of CMake “export” and “import” commands. I chose not to use them simply because I have not yet seen the need of them. Having said that, please do not get me wrong here, I am simply explaining the rationale behind it and not trying to defend it. If someone knows better way to achieve the goal then please do share and contribute it to the project.[/li][/ul]