I thrilled that NetBeans supports projects using CMakeLists.txt. Great job, team!
Here are a few suggestions for enhanced support for CMake:
When Invoking CMake, I would like NetBeans to pass to CMake the currently selected configuration (e.g., Debug or Release), something like:
At present, it seems to always invoke cmake with the "Debug" configuration:
As a further improvement, appropriate compiler flags may also be passed. For example, when building the "Debug" configuration, the command could be something like
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS_DEBUG=<cCompilerFlags> -DCMAKE_CXX_FLAGS_DEBUG=<cppCompilerFlags> -DCMAKE_EXE_LINKER_FLAGS_DEBUG=<ldFlags>
and when building the "Release" configuration, the command would be modified to something like
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE=<cCompilerFlags> -DCMAKE_CXX_FLAGS_RELEASE=<cppCompilerFlags> -DCMAKE_EXE_LINKER_FLAGS_RELEASE=<ldFlags>
While this isn't necessarily extensible to configurations with names other than "Debug" or "Release", it seems there are two not-bad options in those cases:
(1) Just use the "Debug" configuration commands for everything but the "Release" builds -- this would be no worse than what NetBeans is currently doing (which is always using the Debug configuration commands).
(2) Use the configuration name essentially as-is (but with any spaces removed):
cmake -DCMAKE_BUILD_TYPE=<configuration> -DCMAKE_C_FLAGS_<configuration>=<cCompilerFlags> -DCMAKE_CXX_FLAGS_<configuration>=<cppCompilerFlags> -DCMAKE_EXE_LINKER_FLAGS_<configuration>=<ldFlags>
I'm not certain how cmake handles this if <configuration> is something other than "Debug" or "Release", but I think in the worst case things would revert to the defaults defined the CMakeLists.txt file, which seems no worse than what NetBeans is currently doing.
Build the project in a subdirectory of the project directory or source directory:
1) cd <projectdirectory>
2) mkdir build; cd build
3) mkdir <configuration>; cd <configuration>
4) mkdir <toolcollection>-<developmenthost>; cd <toolcollection>-<developmenthost>
5) cmake <commandlineoptions> ../../..
Any variation of this would be acceptable to me. It would probably be best for NetBeans to essentially mirror the build commands it follows for "managed" projects.
I recognize that, at present, the notions of <configuration>, <toolcollection>, and <developmenthost> are less clear for CMake-based projects than they are for managed Makefile projects, but any subset or appropriate adaptation of the above build commands would be an improvement.
+1 More configurability for CMake would be excellent. Especially building in a non-source directory.
I agree also. I want to build source files by MS Visual Studio without GNU make
(In reply to comment #1)
> +1 More configurability for CMake would be excellent. Especially building in a
> non-source directory.
I VERY much agree. I have a project using CMake that does not play well with being built in the source directory, its an unfortunate bug, but one we never noticed, since building in the source directory just isn't very CMake-ish.
Suggestion III was fixed in Bug #175374
+1 for enhanced CMake support. I'd really like to see configuration of CMAKE_BUILD_TYPE.
Another +1 from me. It would be very, very helpful to work with CMake. Having to have multiple projects just for different BUILD_TYPEs is not really great.