I am using cmake for my project, but I have another library in a subdirectory ( say lib/ ) which uses a plain Makefile. How do I instruct CMake to run the Makefile in lib as part of the build process?
The solution is to use:
execute_process ( COMMAND make WORKING_DIRECTORY ${project_SOURCE_DIR}/path/to/lib )
If your /lib contains its own CMakeLists.txt, just use the add_subdirectory command:
add_subdirectory(/path/of/your/lib/that/contains/CMakeLists.txt)
Else
you have to use exec_program command:
exec_program(script.sh)
where script.sh is
#!/bin/sh
cd /path/of/your/lib/ && make
do not forget
chmod +x script.sh
In my opinion, the first solution is better !!!
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