[CMake] How to rename the resulting Makefile.

Bill Hoffman bill.hoffman at kitware.com
Tue Oct 12 11:27:36 EDT 2010


On 10/12/2010 11:14 AM, william.crocker at analog.com wrote:
>
>>>
>>> [ elided ]
>>>
>>> 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
>>
>
> Okay. I see that OOS builds can create Makefiles without clobbering
> my existing Makefile, but then I do not have convenient access to my
> Makefiles
> and the convenience targets they contain from the OOS dir.
>
> I still think Qt/qmake was right in providing the ability to change
> the name of the Makefile. Before I discovered that, I could not use
> the qmake system.
>
> Below is typical of what my Makefile contains:
> Convenience targets (all in one place) and a call to the makefile
> created by qmake (myapp.make). In this way qmake does not have to solve
> the whole problem, just contribute a part of the solution.
>
> Thanks.
>
> Bill
>
> ------------------
>
> myapp : always
> make -f myapp.make
>
> save : always
> mkdir -p save_dir
> /bin/cp -pr *.h *.cc *.lyx *.xml *.xsl *.txt *.css Makefile save_dir
>

You can do all of that with custom_commands in CMake, and have it work 
out of source, and cross platform.

-Bill


More information about the CMake mailing list