RE [CMake] Eclipse CDT and CMake

Mike Jackson imikejackson at gmail.com
Mon Jul 23 23:05:05 EDT 2007


Andy, sorry for the problems that you had trying to follow my
instructions. Let me address some of your troubles.

1] The CMake Editor plugin is just that.. A plugin for Eclipse that
will do syntax coloring and some "code completion" for CMake commands
in CMake files ("CMakeLists.txt and *.cmake). This plugin does NO
project management at all. Let me repeat.. This plugin will do NO
Project management of either CMake files or Eclipse CDT projects.

When I wrote the tutorial I assumed some knowledge of CMake and how it
works and was aimed at those that wanted to use CMake in conjunction
with Eclipse. Maybe I should have stated that on the Wiki..

2] The MyProject "Example" is just a placeholder. There really is not
any example. I was just using this as an example of how to layout a
project. Again, I assumed that the reader already had a project and
was wanting to use that existing project with CMake and Eclipse. This
probably was not a good assumption. In Hind sight I should have used
an example from the actual CMake distribution. I will try and update
the wiki to use this example instead, hopefully making things more
clear.

3] "Why am I running ccmake from the comand line?" A clean project
that is based on CMake typically will NOT have any type of Makefile
ready to go. That is the point of CMake, to auto-generate Makefiles
(or other platform specific project files) from the CMakeLists.txt
file (and other supporting *.cmake files). So by default Eclipse has
no idea what to do with a CMake based project. Also not that when
setting up the project in Eclipse you need to select the "Makefile"
based project as _you_ will be providing Makefiles, generated by
CMake, to Eclipse CDT to use for the build process. By running  ccmake
or cmake (your choice) from the command line before setting too many
things in Eclipse, Eclipse will complain less or not at all when you
set up your project. This is kind of boot strapping the process a bit
as there is no real integration of CMake with Eclipse. The
"integration" is that Cmake will generate and keep up to date the
makefiles that Eclipse will use for its build.

I hope that helps explain some things. If I get some time on Tuesday,
I will rewrite parts of the Tutorial to use the Example that comes
with CMake instead of my own "virtual" example.

Again, I am sorry for the troubles that you may have had with my
instructions/tutorial. Keep asking questions and the community will
try to help answer them.

Respectfully
Mike Jackson


On 7/23/07, Andy Dingfelder <DingfelderA at sirtrack.com> wrote:
> sorry, I missed one step, from the wiki example.
> Mike, you talk about manually running ccmake from the command line.
>
> I am not clear why you do this...
> from what it asked me to do, my best guess is that this file is used to
> define the output dirs for the libraries or executables the make
> creates.
>
> It would be super-nice if the cmake plugin could have these set up as
> defaults within eclipse so you don't have to do this manually for each
> project.
>
> it also still seems that you still have to manually create a
> CMakeLists.txt file before this step, such as:
>
> # The name of our project is "HELLO".  CMakeLists files in this project
> can
> # refer to the root source directory of the project as
> ${HELLO_SOURCE_DIR} and
> # to the root binary directory of the project as ${HELLO_BINARY_DIR}.
> project (HELLO)
>
> IF(CMAKE_COMPILER_IS_GNUCC)
>   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
> ENDIF(CMAKE_COMPILER_IS_GNUCC)
> IF(CMAKE_COMPILER_IS_GNUCXX)
>   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
>
> SET(CMAKE_VERBOSE_MAKEFILE ON)
>
> # Recurse into the "Hello" and "Demo" subdirectories.  This does not
> actually
> # cause another cmake executable to run.  The same process will walk
> through
> # the project's entire directory structure.
> #add_subdirectory (Hello)
> #add_subdirectory (Demo)
> # Make sure the compiler can find include files from our Hello
> library.
> include_directories (${HELLO_SOURCE_DIR})
>
> # Make sure the linker can find the Hello library once it is built.
> link_directories (${HELLO_BINARY_DIR})
>
> # Add executable called "helloDemo" that is built from the source
> files
> # "demo.cxx" and "demo_b.cxx".  The extensions are automatically
> found.
> add_executable (helloWorld helloworld.cpp)
>
> # Link the executable to the Hello library.
> #target_link_libraries (helloWorld Hello)
>
> so you might want to add more info about what ccmake does in the wiki,
> and add a default  CMakeLists.txt file.
>
> Cheers,
>
> Ding
>
> >>> Andy Dingfelder 24/07/2007 10:51:21 a.m. >>>
> I've been reading through the thread on Eclipse CDT and CMake and have
> a couple questions.
>
> I have installed the eclipse plugin from
> http://www.cthing.com/CMakeEd.asp
> It color codes the CMakeLists.txt file, not sure what else it does, as
> it did not have any documentation I could see and  there is no help or
> faq on their website.
>
> I ran through the instructions on the wiki:
> http://paraview.org/Wiki/CMake:Eclipse
> and was not clear on a couple of points.
>
> First of all, the example refers to a helloworld.cpp file, which does
> not exist by default... perhaps it needs to be added to the wiki?
> I could use eclipse to generate a class file named helloworld but I am
> not sure if the example needs any particular code.
>
> the example also shows a CMakeLists.txt file which also does not
> exist.
>
> What would go into it?
>
> Moving on and guessing about where I could go from here, I then
> downloaded the example code from http://www.cmake.org/HTML/Examples.html
> and dropped it into my new project, and did an eclipse "build all".
>
> It did a build, and generated some files, but did not make the
> executable output that I expected.
>
> ...
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> WARNING: This email and any attachments may be confidential and/or
> privileged. They are intended for the addressee only and are not to be read,
> used, copied or disseminated by anyone receiving them in error.  If you are
> not the intended recipient, please notify the sender by return email and
> delete this message and any attachments.
>
> The views expressed in this email are those of the sender and do not
> necessarily reflect the official views of Landcare Research.
>
> SirTrack
> http://www.sirtrack.com
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


-- 
Mike Jackson
imikejackson _at_ gee-mail dot com


More information about the CMake mailing list