Skip to content

CMake Cleanup, master branch (2020.10.26.)

In connection to atlas/atlasexternals!745 (merged) I was trying to clean up the CMake configuration of the repository a bit before collecting the new version into the Athena nightlies. The set of changes grew pretty big unfortunately. 😦

In the "main project configuration" I shuffled the files around a little, and removed some files that I felt really didn't deserve to be separate files. The main CMakeLists.txt file of the repository is reasonably short. It doesn't make it more readable if we move O(5) line chunks out of it into separate files. Also, I didn't think that having CMake files in separate cmake/ and dependencies/ directories was a nice setup. I just moved everything (that I kept) under cmake/.

I then updated the Setup<Foo>.cmake files to set up "imported targets" for the things that they're building, if the user requests this project to build those externals. So that the different libraries/executables could set up dependencies on imported targets like Eigen3::Eigen, XercesC::XercesC, etc. Which is important to make the exported CMake configurations relocatable.

Then I updated the configuration of GeoModelCore, GeoModelIO and GeoModelTools to set up themselves in a reasonably consistent way. Relying on the newly introduced imported targets for their builds, and updating their exported CMake configurations to look for the external dependencies needed by these sub-projects when the user sets up these sub-projects.

I also tweaked the CPack configuration of these 3 sub-projects. Note that in this area we should do more though. Right now CPack doesn't quite behave how I think everybody assumes it does. CPack only builds a single package out of the entire repository. (Or 2 RPMs/DEBs for the runtime and development packages.) So the separate CPack configurations for the different sub-projects are just piling on each other. CPack in the end obeys the last set of configuration options that it sees. Which are coming from GeoModelTools/cmake/GeoModelToolsPackaging.cmake at the moment...

Finally I adjusted the CI setup a bit. I had to realise that the macOS CI machine used by the main repository is not available to the forks of the repository. (And it's good like this. Private machines should not be possible to use from forks.) So I tried to extend the CI setup to turn off those tests in a fork. However I'm not at all sure that my incantation is correct at the moment. 😦 (I don't know what the exact repository URL is supposed to be in the CI.) The tests are turned off in my fork now, but they may have been turned off in the main repository with these changes as well... 🤔

On top of this I also updated the CI to install CMake 3.14 on Ubuntu for the test. Which is something that we discussed with @rbianchi offline for a bit, but we could continue the discussion on here.

Merge request reports