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?
A:
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 !!!
Nadir SOUALEM
2009-10-01 07:40:40
thanks for the reply, but execute_process() has superseded it. I found the answer the next day.
Nikhil
2009-10-01 13:56:24
+1
A:
The solution is to use:
execute_process ( COMMAND make WORKING_DIRECTORY ${project_SOURCE_DIR}/path/to/lib )
Nikhil
2009-10-01 13:57:48