Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Support for CodeBlocks in CMake

<< < (7/7)

alex.neundorf:

--- Quote from: Biplab on August 30, 2007, 05:43:14 pm ---
--- Quote from: alex.neundorf on August 29, 2007, 09:41:46 pm ---I can't get "Build file" to work.

--- End quote ---

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
--- End quote ---

--- End quote ---

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


--- Quote from: Biplab on August 30, 2007, 05:43:14 pm ---
--- Quote from: alex.neundorf on August 29, 2007, 09:41:46 pm ---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.

--- End quote ---

I prefer the second approach as it suits CMake requirement.

--- End quote ---

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


--- Quote from: Biplab on August 30, 2007, 05:43:14 pm ---But you may consider to have One Target per Directory and then these targets belong to a single Project.


--- End quote ---

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

Biplab:

--- Quote from: alex.neundorf on August 31, 2007, 03:47:15 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

--- End quote ---

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.


--- Quote from: alex.neundorf on August 31, 2007, 03:47:15 pm ---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

--- End quote ---

Currently for make files, the object creation and output creation is Not handled by C::B. It just executes the makefile.

thomas:

--- 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

--- End quote ---
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
--- End quote ---
<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?

alex.neundorf:
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

Navigation

[0] Message Index

[*] Previous page

Go to full version