[CMake] How to rename the resulting Makefile.

Bill Hoffman bill.hoffman at kitware.com
Tue Oct 12 10:35:53 EDT 2010


On 10/12/2010 10:17 AM, william.crocker at analog.com wrote:
> Hello:
>
> I'm a newbie cmake user and would like to rename the makefile
> produced by running cmake.
>
> I have searched the doc, mailinglist-archive and web,
> but to no avail.
>
> This is useful because:
>
> 1 - It provides a convenient way to slowly transition form
> existing makefiles to the use of cmake.
>
> 2 - I fill my makefiles full of all sorts of convenient
> targets like the following and I do not want to have
> to figure out how to do them in cmake.
>
> grep :
> @-for c in ${COMPONENTS} ; do \
> echo "################ grep:" $$c; \
> ( cd ./$$c; grep -i xyz *.h *.c *.cc ) ; \
> done
>
> This is possible with Qt/qmake:
> MAKEFILE = xyz.make
>
> Obviously I could issue an OS command to rename the
> makefile, but that is an extra step which would be forgotten,
> varies from OS to OS and would clobber my real makefile
> which is named Makefile.
>
> So, is there a command I can place in my CMakeLists.txt files
> which will cause them to produce a file named xyz.make (let's say)
> instead of Makefile.
>
> Thanks in advance.

Use out of source builds, and there should be no-conflict.  There is no 
way to rename the makefiles.

mkdir build
cd build.
cmake ../path/to/source
make


-Bill


More information about the CMake mailing list