Bug 187623 - Enhanced support for CMake
Enhanced support for CMake
Status: NEW
Product: cnd
Classification: Unclassified
Component: Toolchain
6.x
All All
: P3 with 5 votes (vote)
: TBD
Assigned To: Alexander Simon
issues@cnd
vcs
:
Depends on: 175374
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-16 01:02 UTC by gbullock
Modified: 2014-03-03 15:10 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo