I'm fairly new at using CMake to manage my build system, so if I'm being stupid and this is a bad idea, please let me know.
I'd like to be able to set up my cmakelists.txt file so that when I do
project( ... )
the name of the directory becomes the project name automatically. I want to do this because I find it convenient to be able to copy the entire directory of one project as the starting point of another. However, though I always rename the directory to something meaningful, I often forget to change the project(name)
line of the cmakelists.txt file, and then I end up with multiple projects open in my build environment with the same name, which gets confusing.
Ideally, if there are spaces in the directory name they'd be replaced by underscores.
Can CMake do this? And is it a bad idea for some reason I'm not seeing?