This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 187623 - Enhanced support for CMake
Summary: Enhanced support for CMake
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Toolchain (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal with 9 votes (vote)
Assignee: danilasergeyev
URL:
Keywords:
Depends on: 175374 247758
Blocks:
  Show dependency tree
 
Reported: 2010-06-16 01:02 UTC by gbullock
Modified: 2015-05-28 07:00 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gbullock 2010-06-16 01:02:38 UTC
I thrilled that NetBeans supports projects using CMakeLists.txt.  Great job, team!

Here are a few suggestions for enhanced support for CMake:

Suggestion I:

When Invoking CMake, I would like NetBeans to pass to CMake the currently selected configuration (e.g., Debug or Release), something like:

  cmake -DCMAKE_BUILD_TYPE=<configuration>

At present, it seems to always invoke cmake with the "Debug" configuration:

  cmake -DCMAKE_BUILD_TYPE=Debug

Suggestion II:

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.

Suggestion III:

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> ../../..
6) make

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.
Comment 1 leedm777 2010-09-03 20:39:03 UTC
+1 More configurability for CMake would be excellent.  Especially building in a non-source directory.
Comment 2 soldatov 2010-09-04 07:59:22 UTC
I agree also. I want to build source files by MS Visual Studio without GNU make
Comment 3 kfitch42 2010-11-15 18:07:52 UTC
(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.
Comment 4 Alexander Simon 2010-11-30 17:26:54 UTC
Suggestion III was fixed in Bug #175374
Comment 5 nderevj 2012-11-22 07:29:24 UTC
+1 for enhanced CMake support. I'd really like to see configuration of CMAKE_BUILD_TYPE.
Comment 6 TheSHEEEP 2013-04-29 07:38:03 UTC
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.