Author Topic: Support for CodeBlocks in CMake  (Read 46407 times)

alex.neundorf

  • Guest
Re: Support for CodeBlocks in CMake
« Reply #30 on: August 31, 2007, 03:47:15 pm »
I can't get "Build file" to work.

You're right. To compile a single file, it requires a project to be defined.

Because CMake is generating makefiles to be compiled with C::B, I don't see a way to compile a single file of any project. Actually you can (I've never tried that), but C::B will supply default arguments in that case. So if the project has one file named foo.cpp it will be compiled as-
Quote
g++ -o foo -c foo.cpp

I don't understand.
I can supply a make command for building single files with the CompileFile tag. CB uses that command, it also replaces $file with the location where it thinks the object file will be. But CMake puts these files in a different location and the targets for building the object files are not available in all directories, only in the makefile for the target to which the object file belongs.

I need one of two things from CB to make this work:
1) make it possible to assign a CompileFile tag to every file in the <Unit> tag
or
2) make it possible to somehow tell CB how to construct the name of the target for the object files and in which directories to execute them. For cmake this is
make -f <path to directory for the target>/Makefile <filename>.o

The project is organized like this:
one project is created, which contains targets for all executables/libraries within the source tree. No workspace is created (since all targets are already in the one project).

It would also be possible to create one project per target and then have one workspace which includes all projects. The only problem is that cmake targets like clean or install are not per-project, but per-directory, and there can be multiple targets in one directory. This would also make the build-file easier, since the directory is known.

It would also be possible to create one project per directory which has at least one target, and then one workspace which contains all projects. But then again this would give quite strange projectnames...

What do you think would be a good approach ?
Currently I have e.g. for the cmake tree one project "cmake" which has many targets (cmake, ccmake, ctest, cpack) and the source files are not assigned to one of these targets.

I prefer the second approach as it suits CMake requirement.

One project per target ?
I'll try if I find the time.

But you may consider to have One Target per Directory and then these targets belong to a single Project.


No, I can't do that. CMake projects can put as many targets as they want in one directory, and CMake has to create working makefiles/project files for whatever they do.

Alex

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Support for CodeBlocks in CMake
« Reply #31 on: September 02, 2007, 08:03:32 pm »
I need one of two things from CB to make this work:
1) make it possible to assign a CompileFile tag to every file in the <Unit> tag

Sorry for this late reply. You can discuss this with Yiannis.

Personally I dislike this idea. It would clutter the project file with n number of make commands for each source file.

2) make it possible to somehow tell CB how to construct the name of the target for the object files and in which directories to execute them. For cmake this is
make -f <path to directory for the target>/Makefile <filename>.o

Currently for make files, the object creation and output creation is Not handled by C::B. It just executes the makefile.
Be a part of the solution, not a part of the problem.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Support for CodeBlocks in CMake
« Reply #32 on: September 03, 2007, 11:19:33 am »
Quote
I need one of two things from CB to make this work:
1) make it possible to assign a CompileFile tag to every file in the <Unit> tag
This is implemented:
<Unit filename="pumbalumba.tongalanga">
   <Option compile="1" />
</Unit>


However, I am not sure if this is really what you want to use... in any case, it is a cleaner (and more efficient for the project loader) to have the IDE compile files that it recognises as sources.

Quote
how to construct the name of the target for the object files and in which directories to execute them
<Target title="default">
   <Option output="\pumbalumba" prefix_auto="1" extension_auto="1" />
   <Option working_dir="cucucucu\cuuuuuaaaaa" />
   <Option object_output="fee\fei\fo\fum" />
   ...

This does not work?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

alex.neundorf

  • Guest
Re: Support for CodeBlocks in CMake
« Reply #33 on: September 18, 2007, 03:53:14 pm »
No, doesn't work. At least I am able to remove the .objs/ from the object path.

Now I get "make: *** No rule to make target `src dir/CMake/Source/cmDepends.o'.  Stop"
I would need just the filename, without the path:
make cmDepends.o, executed in the right directory.

How can I find out in which directory this was executed ?

Alex