[CMake] Clearing all cmake files

Mike Jackson mike.jackson at bluequartz.net
Tue Sep 9 13:12:29 EDT 2008


And hence the reason to use an "out of source" build. That alleviates  
the problem.

Now, just in case you are still new to cmake, here is a subtle FYI  
about "out of source" builds. The build directory can be a sub  
directory of your project.

MyProject/
     src/
     includes/
     Build <=== CMake Build directory

If you setup like this then cd into the "Build" directory and do  
"cmake ../" and let cmake run. Certain types of IDEs like this  
approach better than others.

Or you can do:

MyProject/
MyProject-Build/

Your choice. But since CMake does create lots of files, using one of  
these techniques is what the CMake developers assume.

I made that same mistake a few times, even tried to "fight it" by  
insisting on in source builds. After a while I got tired of fighting  
and used out of source builds. After that everything fell into place.  
CVS/SVN worked better. Cleaning out CMake was easier. Multiple Build  
types was easier. It all worked as it should. I have never looked back.

Now, you may have a use-case that prohibits you from utilizing either  
of the above situations. If you do I am sure we would like to hear  
about it.

Philosophically I kinda agree that some sort of shell script should be  
able to be generated with a list of files that CMake creates. In  
practice, this isn't needed.

  _________________________________________________
| Mike Jackson - Principal Software Engineer      |
| BlueQuartz Software                             |
| mike.jackson at bluequartz.net                     |
| www.bluequartz.net                              |
---------------------------------------------------

On Sep 9, 2008, at 12:50 PM, Robert Kubrick wrote:

> I did not use an out of source build, so that of course would  
> simplify things, but I still think that a command like:
>
> cmake erase
>
> Would be convenient to clear all cmake generated files and roll-back  
> to the scenario *before* 'cmake .' Yes, I can remove files manually  
> but the user is not supposed to know exactly which files cmake  
> generates. Different versions might change generated files or add  
> hidden files.
>
> On Sep 9, 2008, at 11:08 AM, Mike Jackson wrote:
>
>> I am going to assume then that you DID in fact use an out of source  
>> build for your project. Assuming that build directory is called  
>> "Build" the command is:
>>
>> rm -rf Build/  (Linux/Unix/OS X)
>> Use Windows Explorer to delete the entire build tree on Windows.
>>
>> Those are the commands.
>>
>> Granted they are not the most obvious but they do work. If you have  
>> suggestions let's hear them..
>>
>> ---
>> Mike Jackson - Principal Software Engineer
>> www.bluequartz.net
>>
>>
>>
>>
>> On Sep 9, 2008, at 10:42 AM, Robert Kubrick wrote:
>>
>>>
>>> On Sep 9, 2008, at 10:36 AM, Mike Jackson wrote:
>>>
>>>> If you used an out of source build then you can simply delete the  
>>>> build directory. If you did NOT use an out-of-source build then  
>>>> you are going to have to hand pick through your source  
>>>> directories to find everything that does not belong.
>>>>
>>>> With that said CMakeCache.txt is the first obvious choice for  
>>>> deletion. Next comes CMakeFiles and CMakeTemp. Not sure about  
>>>> anything else.
>>>>
>>>> Also, CMakeLists.txt is the _project_ file. Deleting this file is  
>>>> the same as deleting the .sln on windows, the xcode project file  
>>>> on OS X or the main Makefile on Linux/Unix. Are you sure you  
>>>> really want to remove CMakeLists.txt file?
>>>
>>> No you're right, the CMakeLists.txt is the only file I need to  
>>> keep. In facts I store that under source control.
>>>
>>> I think it would be useful to have a command to clobber the whole  
>>> cmake hierarchy for when you need to prepare a distribution,  
>>> change the compiler settings or clear some conflicts in the build  
>>> tree. It does happen, especially during the project initial setup.
>>>
>>>>
>>>>
>>>> _________________________________________________
>>>> | Mike Jackson - Principal Software Engineer      |
>>>> | BlueQuartz Software                             |
>>>> | mike.jackson at bluequartz.net                     |
>>>> | www.bluequartz.net                              |
>>>> ---------------------------------------------------
>>>>
>>>> On Sep 9, 2008, at 9:55 AM, Robert Kubrick wrote:
>>>>
>>>>> I was wondering if there is a standard command to clear all  
>>>>> cmake files, including CMakeLists.txt, CMakeCache.txt, the  
>>>>> CMakeFiles directory and cmake_install.cmake?
>>>>> _______________________________________________
>>>>> CMake mailing list
>>>>> CMake at cmake.org
>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>
>>>
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>



More information about the CMake mailing list