I want to include a makefile from an outside library in my own software's makefile. The simplest would be to figure out the CMake code for the Makefile equivalent of include ${dir}/makefile
.
But maybe I should give a little context. I'm trying to integrate PETSc (and SLEPc) into my code. Here is some code from an example using SLEPc (although PETSc is pretty much the same):
hello: hello.o chkopts
-${CLINKER} -o hello hello.o ${SLEPC_LIB}
${RM} hello.o
include ${SLEPC_DIR}/conf/slepc_common
As you can see, it requires an include of a specific makefile that includes a bunch of other makefiles. This is a little weird because it seems like it would've been simpler to just have an include directory, but apparently there's more to it than I understand. Anyway, my first solution was to simply include the makefile it wants and see if that works.
I believe this requirement doesn't fit CMake's design model at all as the Makefiles were generated during the generation phase and one of CMake's core principle is to make it cross platform, so the better idea might be:
If the effort is huge, you can try with add_custom_target/add_custom_command to do some out of box commands to tweak generated files, but those would also import considerable efforts - just read the manual and seek more opportunities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With