I've written a little plugin which generates a CMake configuration file (CMakeLists.txt) file for the current workspace and the currently active target. At the moment it is very limited, it only works on Linux (I'll fix this asap) it does the following:
1. Prompts for an output directory for the file
2. Asks for a name for the CMake project ( a CMake "project" pretty much equates to a "workspace")
3. With this information the relative paths of the source files for each project are calculated and stored
4. Each project's include directories are read and if pkg-config or wx-config commands are in the list of compiler options they are called and the output parsed
5. Same thing happens with the libraries
6. Any compiler flags are read
7. Everything is written to the CMakeLists.txt file using ADD_EXECUTABLE or ADD_LIBRARY depending on the target type
I've tested the plugin on itself (to generate the file) and then successfully compiled the plugin outside of CodeBlocks using CMake (hehe, recursive
) and my friend has tested it on his projects, it seems to work.
This is the TODO list:
1. Get it working on Windows
2. If any project names begin with "test" add them to cmake as unit tests
3. Somehow add some per-project options to specify per project custom commands (e.g. CMake module checks)
4. Add multiple build targets to the cmake output
5. Write a configuration dialog (options like required cmake version etc.)
The plugin can be downloaded from:
http://www.kazade.co.uk/downloads/CMake_Generator.cbplugin . If people could just try it out on their current workspace to generate the file, then go to the output directory in a terminal and type "cmake . && make" and let me know if it works that would be cool (obviously, you need cmake installed).
I'll upload the source later... when it's a little less hacky
P.S.
I'm new to this plugin writing... and wxString. Can someone tell me, what is the best way to concatenate the content of two wxArrayString instances? At the moment I'm looping and adding the second to the first but this is a few lines of code.. I was hoping there was a way to do it in a single statement.