GEOS-ESM / ESMA-Baselibs

Base Libraries for the GEOS ESM
Apache License 2.0
1 stars 10 forks source link

Move to canonical CMake #180

Closed mathomp4 closed 4 months ago

mathomp4 commented 4 months ago

For reasons unknown to me (and @tclune), builds of GFE on bucy started...failing. It worked four times, but the fifth time...nope! The CMake started acting "wonky" like it was seeing more of the environment than it should have.

So, channeling @scivision, if we move Baselibs from:

cd ./package/build
cmake -DCMAKE_INSTALL_PREFIX=$(prefix) ..

to:

cd ./package
cmake -B build -S . --install-prefix=$(prefix)

the GFE build worked.

Now, as far as I know these do the same thing, but the first one failed, the second one worked. Why? 🤷🏼 But moving to "canonical" CMake is only a good thing.


At the beginning, I hardcoded the number of make jobs to the CMake install command to be -j4 which means it doesn't inherit from $(MAKE). But internet says that:

N := $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))

should work. My testing shows:

MAKEJOBS = $(patsubst -j%,%,$(filter -j%,$(MFLAGS)))

is right. Not sure why the : mattered, and I don't care as I don't want to go through the fun of GNU Make 😄

mathomp4 commented 4 months ago

Hmm. I now realize I could go from:

cd ./package
cmake -B build -S . --install-prefix=$(prefix)

to:

cmake -B ./package/build -S . --install-prefix=$(prefix)

Would be cleaner...

scivision commented 4 months ago

the cmake --build -j 4 can be elided by

export CMAKE_BUILD_PARALLEL_LEVEL=4

or however you prefer to set that environment variable. You can omit the cmake --build --parallel or cmake --build -j entirely as that environment variable sets parallel build implicitly.