replace Makefile with CMakeLists.txt #17
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the entire Makefile build infrastructure with a CMake based one. This is how I would structure the
CMakeLists.txtfor the project. However, whether it is desirable at all to switch to CMake is up for debate.What there is to like:
pkgs/a653lib.nix), cross compiler configuration just works without further ado.time ( clear ; rm -rf build ; cmake -Bbuild && cmake --build build --parallel )takes 2.058s on my laptop)CMakeLists.txtis a bit more concise than theMakefiles--installcommand, see the following out directory layout:Makefileetc. without issue. We could even generate a pkg-config file?bear1 to generate acompile_commands.jsonfor better IDE support, CMake does it out of the box.Makefilecreating a files/directorys directly in my home dir (I much prefer if project build artifacts remain in the projects respective directory).What there is to dislike:
cmake -Bbuild ; cmake --build buildinstead of onemake(though after the first command, in thebuild/dir there is aMakefileand one can iterate with justmakeas usual --- after all CMake generates a Makefile.cmake -D CMAKE_C_COMPILER=gcc-4.2is reasonable, and CMake does take aCFLAGS3 and aLDFLAGS4 environment variable for this very purpose)Makefile. (albeit with arguable more effort)Footnotes
https://github.com/rizsotto/Bear ↩
https://cmake.org/cmake/help/latest/command/file.html#filesystem ↩
https://cmake.org/cmake/help/latest/envvar/CFLAGS.html ↩
https://cmake.org/cmake/help/latest/envvar/LDFLAGS.html ↩