View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004209CMakeCMakepublic2006-12-14 12:332008-11-17 11:54
Reporteraxel.roebel 
Assigned ToDavid Cole 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004209: Xcode generator ignores EXCLUDE_FROM_ALL targets
DescriptionThe Xcode generator completely ignores all targets that are not part of the all target,
notably targets defined in sub directories
that have the EXCLUDE_FROM_ALL flag set.
TagsNo tags attached.
Attached Filestgz file icon testxc.tgz [^] (395 bytes) 2008-06-03 07:03

 Relationships

  Notes
(0008076)
axel.roebel (reporter)
2007-07-17 04:01

Changed priority. Low priority was in fact a
mistake in the original post. This bug
is severe because it affects cross platform
usage. You cannot rely on the fact that the
CMake project you create will work on different
platforms.
(0010109)
Bill Hoffman (manager)
2008-01-10 15:43

Can you give a sample project and describe the problem that this causes?
(0012207)
axel.roebel (reporter)
2008-06-03 07:07

Hi Bill,

I come back to this issue after having verified that
it still persists in cmake 2.6.

I created a little test project showing the issue.
You find it attached to this bug report.
 
If you create the Xcode project using cmake 2.6.0
as follows

cmake -GXcode ../testxc

you'll find that the target defined in the subdirectory
m2 which is included using ADD_SUBDIRECTORY (... EXCLUDE_FROM_ALL)
does not show up as a target.

Cheers,
Axel
(0012208)
axel.roebel (reporter)
2008-06-03 07:08

Just to mention. I tried as well

ADD_EXCUTABLE(me EXCLUDE_FROM_ALL me.c)

not in a subdirectory. That works fine.
(0013883)
David Cole (manager)
2008-10-15 10:24

EXCLUDE_FROM_ALL has different meanings in ADD_SUBDIRECTORY and in ADD_[cmake exe/lib/custom target] commands.

Please read "cmake --help-command ADD_SUBDIRECTORY" carefully with respect to the EXCLUDE_FROM_ALL flag. If there are dependencies on any of the libs in the sub-dir, they will be pulled in anyhow because they are required, overriding your EXCLUDE_FROM_ALL request.

If you want a separate Xcode project generated in the subdirectory so that you can open it there and build the sub-project, make sure to use the CMake "PROJECT" command in the sub-dir's CMakeLists.txt file.

If you want it included in your main Xcode project, but simply excluded from the ALL target, then use ADD_SUBDIRECTORY *without* the EXCLUDE_FROM_ALL flag and use ADD_EXECUTABLE or ADD_LIBRARY in the sub-dir *with* the (different) EXCLUDE_FROM_ALL flag.

If you still think there is something wrong with the CMake code, please clarify. It is working as I expect based on the documentation and comparing how it works with Xcode on the Mac and Visual Studio on Windows...

Thanks,
David
(0014119)
axel.roebel (reporter)
2008-11-16 07:19

Hi David,

I saw that the documentation of the EXCLUDE_FROM_ALL changed between
2.6.0 and 2.6.2. Indeed in 2.6.2 this behavior is conform with the doc.
(It wasn't in 2.6.0).

I don't think it is a wise choice to introduce these kinds of build system dependencies into the cmake configuration system. It basically means that
the EXCLUDE_FROM_ALL flag in add_subdirectory is useless for all projects that want to deliver their sources because you cannot know whether your client will use a command line build system or an IDE. Which means you have to be prepared for both (meaning putting exclude_from_all into all sub dir targets).
Anyway, you make the choice and I will simply stop using this feature.

Thanks for correcting the doc.

Axel
(0014120)
axel.roebel (reporter)
2008-11-16 07:23

I just wanted to comment. You may close again. I consider this finished.

Thanks.
(0014121)
Bill Hoffman (manager)
2008-11-16 10:57

I am still not sure how this is inconsistent with the other generators. The bug that was fixed, is that the sub projects are now complete. If you have an executable that depends on a library, then that library needs to be in the sub project or the sub project will be incomplete and likely not to work. Perhaps if you gave explained a simple use case we would understand what you want.
(0014122)
axel.roebel (reporter)
2008-11-16 12:38

Hello Bill,

I have for example the Easdif project on sourceforge. It comes with some tests
and demos that I don't want to be run by all users.
So I want to exclude them from the all target.
Each test/demo may have executables attached. Now I have
to exclude them individually from "all" for not building the test executables
on IDEs. Obviously I don't want IDE users to be not able to build
the tests or demos at all!

an example directory layout is
master_src
master_src/lib
master_src/demo
master_src/test

lib is providing the default target, demo and test have targets
that should be explicitly requested

This is important to be able to do
>make
>make install

without waiting for all tests and the related test executables to be build (I run them once, and if they are fine I build and install on different computers)

Note, that libEasif is a really small project.
In some of my projects I have a total of more than 200 targets,
so marking all targets individually is a nightmare.

The most annoying thing of all is the fact that, as it is now, the configured project has different targets with the different build systems. So using Unix Makefiles I cannot know which target would be available in an IDE. I have to run
it in an ide myself, and testing the availability of 200 targets in an IDE
is a problem in itself.

As a last remark. I don't understand the idea that is proposed in the doc,
that one should have a project in a sub directory.
I had hoped that the cmake configure pass would create the project files of the exclude from all targets in the sub directory. This is not the case as you can easily see with test project I have attached a long time ago.

Besides this little inconvenience I must say one other thing:
cmake is one of the best things that ever happened for cross platform developement!

Thanks a lot for your efforts.
Best regards

Axel
(0014127)
David Cole (manager)
2008-11-17 11:54

Closing again per Axel's note of 2008-11-16 07:23...

Axel, one more suggestion you may want to try: simply have your own option variable that controls whether tests are built or not, and conditionally use ADD_LIBRARY or ADD_EXECUTABLE *without* EXCLUDE_FROM_ALL based on your option value.

That way, when configured with testing, the tests are built as part of "all" during your make. When configured without testing, the tests are not built at all... giving you your quick make/make install cycle.

 Issue History
Date Modified Username Field Change
2008-01-10 15:43 Bill Hoffman Note Added: 0010109
2008-06-03 07:03 axel.roebel File Added: testxc.tgz
2008-06-03 07:07 axel.roebel Note Added: 0012207
2008-06-03 07:08 axel.roebel Note Added: 0012208
2008-10-10 08:38 Bill Hoffman Assigned To Bill Hoffman => David Cole
2008-10-15 10:24 David Cole Status assigned => resolved
2008-10-15 10:24 David Cole Resolution open => no change required
2008-10-15 10:24 David Cole Note Added: 0013883
2008-11-16 07:19 axel.roebel Note Added: 0014119
2008-11-16 07:19 axel.roebel Status resolved => feedback
2008-11-16 07:19 axel.roebel Resolution no change required => reopened
2008-11-16 07:23 axel.roebel Note Added: 0014120
2008-11-16 10:57 Bill Hoffman Note Added: 0014121
2008-11-16 12:38 axel.roebel Note Added: 0014122
2008-11-17 11:54 David Cole Note Added: 0014127
2008-11-17 11:54 David Cole Status feedback => closed
2008-11-17 11:54 David Cole Resolution reopened => no change required


Copyright © 2000 - 2018 MantisBT Team