The CMake Wiki mentions the options to use CMake with Eclipse. This Eclipse plugin offers an option to automatically generate buildscripts for the Eclipse CDT managed build system from your CMake scripts.
Blindly invoked, CMake will generate makefiles (or other build scripts) inside the source tree, cluttering it with lots of files and directories that have to be fleed out from version control: This practice might be ok for simple hello-world-projects, but for larger projects, the CMake developers recommend You to set up a separate directory for building the source.
Annoyingly, these recommended out-of-source-builds impose some tedious tasks on Your co-workers who check out the code and just want to build it:
- leave eclipse workbench,
- manually fire up a command-line shell,
- manually create a directory for the out-of-source-build,
- manually change the CWD to that directory,
- manually invoke cmake, telling it to generate build scripts, which kind of build scripts you want and where source source files live,
- re-enter eclipse workbench, configure the checked out project to use the generated buildscripts.
Cmake4eclipse aims to address these tasks: Co-workers can just check out the source and have all the tedious tasks automated.
Screenshots can be found at the Eclipse Marketplace.
- If you do not have any existing code, check out the Sample Projects, chose one and fill in your code.
- If you have an existing C/C++ project code, inside Eclipse, goto
Help:Help Contents
, then read theCMake for CDT User Guide:Getting Started
node to adjust your project settings.
The plugin is licensed under the Eclipse Public License Version 1.0 ("EPL").
CDT v 8.7 or newer and Eclipse v 4.5 (Mars) or newer
Java 8 or newer
The easiest way is to drag this: to your running Eclipse workbench.
Alternatively, cmake4eclipse can be installed into Eclipse using the "Install New Software..." dialog and entering the update site URL listed below.
This composite update site is for use in a Eclipse workbench and contains the latest release as well as selected older releases: https://raw.githubusercontent.com/15knots/cmake4eclipse/master/releng/comp-update/.
Tool integrators will find each release at bintray.
Each release is provided as a standalone zipped p2 repository and can be consumed in a PDE target platform. To add one
of these repositories to your target platform, add a Software Site and enter a URL for the location as
jar:https://dl.bintray.com/15knots/p2-zip/cmake4eclipse-1.12.1.zip!/ (note the leading jar:
and the trailing
!/
).
This project uses Apache maven as its build system.
To build from a command-line, run mvn -f ./parent/pom.xml package
in the root directory of the project source files.
There is a run configuration for eclipse to invoke maven build cmake4eclipse
plus a launch configuration to debug the plugin: cmake4eclipse
.
- Fix #94: CMAKE_EXPORT_COMPILE_COMMANDS parser fails to parse inline-command-files @<<...<<
- Fix #97: Adjust documentation to newer CDT versions.
- CMAKE_EXPORT_COMPILE_COMMANDS Built-ins Parser: run detection in container, if build runs in container.
- UI/doc: Use Cmake4eclipse instead of just CMake to avoid confusion with CDT`s new cmake support.
- Add optional console view for compiler built-ins detection (#96).
- Fix: CMAKE_EXPORT_COMPILE_COMMANDS * Parser settings were not persisted for projects.
- Change related to #73 (CMake Error Parser): Deleted the old parser (which was based on CDT output handling and gave poor results) and re-wrote it from scratch. Note that the new parser does not claim to detect any cmake message; more input from the community is required to detect more messages.
- Removed deprecated CMake Build Output Parser.
- Fixed #86: Parsing compile_commands.json creates duplicate entries.
- Fixed #85: Poor workbench startup performance due to doing a IIndexManger.reindex().
- Fixed #84: CMAKE_EXPORT_COMPILE_COMMANDS Parser no longer detects macros specified on a command-line.
- Fixed #79: CMAKE_EXPORT_COMPILE_COMMANDS Parser does not detect compiler-built-in macros and include paths.
- Builtins-detector get no longer started in non-existing CWD.
- Plugin now requires Java 8, Eclipse 4.5 (mars) and CDT 8.7 to run.
- Reworked documentation (a little).
- Fixed #79: CMAKE_EXPORT_COMPILE_COMMANDS Parser does not detect compiler-built-in macros and include paths. (Forget CDT's GCC-builtin-specs-detector:-)
- Fixed #78: NPE when running builder 'CDT Builder' on project.
- Fixed #80: Custom build command is not used verbatim.
- Eliminate duplicate mnemonics in UI.
- Build in docker container: Fix NPE occurring in CDT 9.4+ with docker build launcher.
- Build in docker container: let CDT copy header files back when building in a docker container.
- Fixed #52: Allow to run parallel builds.
- Fail the build if build tool name cannot be determined from CMakeCache.txt.
- Fixed #65: Recognize nvcc as a CUDA compiler and integrate with the Nsight Eclipse Plugins.
- Merge pull request #67 from @havogt: Allow -isystem without whitespace.
- Fixed #68: Allow to parse -isystem= (nvcc compiler).
- Fixed #64: Project is fully reindexed after each build.
- Enhancement: Improve diagnostic messages during build-script generation.
- Enhancement #23: Handle CDT variables instead of just eclipse core variables.
- Enhancement #58: CMAKE_EXPORT_COMPILE_COMMANDS Parser now evaluates compiler options passed in a "response file".
- Enhancement #52: Make 'CMake Make Builder' GNU-make specific and allow to build in parallel. Builder renamed to 'CMake Builder (GNU Make)'
- Enhancement #54: Support variable expansion in build output location.
- Fixed #55: NPE if project is of plain make-nature (no managed build).
- Fixed #51: No error message in build log, when cmake executable could not be found.
- Revised online documentation.
- Enhancement #57: Add workaround for relative include paths produced by cmake`s ninja generator.
- Enhancement #29: make the Output directory configurable
- Fixed #48 NPE in project configuration when OK button is clicked
- Enhancement #46 Populate CMake cache entries from a file
- Enhancement: Added mnemonics to UI
- Fixed: "ResourceException: The resource tree is locked for modifications" when opening project.
- Fixed #38: Build occurs in eclipse install directory.
- fixed #43 CMAKE_EXPORT_COMPILE_COMMANDS Parser should support different versions of compilers
- Fixed #44: CMAKE_EXPORT_COMPILE_COMMANDS Parser fails for command paths using a forward slash
- CMAKE_EXPORT_COMPILE_COMMANDS Parser show problems in Problems View instead of writing them to the application log file
- Fixed #36: Variable substitution for CMake executable
- Added documentation on project builders
- Fixed #41: CMAKE_EXPORT_COMPILE_COMMANDS Parser doesn't work if compiler command doesn't contain full path
- Fixed #39: Enabling build output parser does not pass necessary arguments to cmake
- Closed #26: CMakeFiles, cache and others generated into wrong directory
- Closed #31: CMAKE_EXPORT_COMPILE_COMMANDS Parser fails if compiler executable has a MSDOS "Short path" name. Thanks to @nolange for reporting and testing under windows
- Requires Java 7 or newer
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.8.zip!/
CDT v 8.7 or newer and Eclipse v 4.5 (Mars) or newer
Java 8 or newer
- Closed #28: CMAKE_BUILD_TOOL is deprecated in cmake version 3.0
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.7.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- Closed #24: CMake dialog box does not save all modified configs.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.6.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- Closed #20: CMAKE_EXPORT_COMPILE_COMMANDS Parser treats clang++ as a C compiler.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.5.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- Closed #17: CMAKE_EXPORT_COMPILE_COMMANDS parser doesn't recognize g++ as a C++ compiler.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.4.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- Closed #16: The CMAKE_EXPORT_COMPILE_COMMANDS parser now knows about GCC cross compilers for C and C++ if the compiler executable follows the naming convention of
<target_triplet>-gcc
or<target_triplet>-g++
.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.3.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- CMAKE_EXPORT_COMPILE_COMMANDS Parser triggers UI update to show newly detected include paths in project explorer view.
- Closed #14: Pass variables given in C++ Build->Environment to the cmake process.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.2.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
- Closes #9: Improve support for code-completion and symbol browsing in CDT source editors.
- Closes #10: Can't install version 1.4.0 in eclipse mars.2 release 4.5.2
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.4.1.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
These releases are made available as a zipped p2 repository. To install, use the "Install New Software..." menu and paste the appropriate repository URL from below into the "Work with" input field.
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.3.5.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.3.4.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://bintray.com/artifact/download/15knots/p2-zip/cmake4eclipse-1.3.3.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/cmake4eclipsecdt-1.3.2.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/cmake4eclipsecdt-1.3.1.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/cmake4eclipsecdt-1.3.0.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/cmake4eclipsecdt-1.1.0.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
jar:https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/cmake4eclipsecdt-1.0.0.zip!/
CDT v 8.1.0 or higher and Eclipse v 3.8.0 (Juno) or higher
Other revisions can be found at https://googledrive.com/host/0B-QU1Qnto3huZUZ0QUdxM01pR0U/ .
Do not forget to add the trailing !/ to the repository URL!