At 03:20 AM 5/12/2006, John Biddiscombe wrote:
>>PROJECT(SUBDIR)
>>SUBDIRS(Executable EXCLUDE_FROM_ALL Examples)
>
>OK. The EXCLUDE_FROM_ALL flag is doing what it is supposed to do. The (in this 
>case) Examples projects are not built by default. However, they do still 
>appear in the IDE (Vis Stud).

There is a test in CMake/Tests/SubDir.  If I load the solution for that test,
SUBDIR.sln it does not have example1 or example2 in it.   

It does this:
SUBDIRS(Executable EXCLUDE_FROM_ALL Examples)

Examples has example1 and example2.   So, exclude from all is supposed to
keep the projects out of the top level sln file.


>I'd like to do this
>ADD_SUBDIRECTORY(UtilityLib1 EXCLUDE_IF_UNUSED)
>ADD_SUBDIRECTORY(UtilityLib2 EXCLUDE_IF_UNUSED)
>ADD_SUBDIRECTORY(UtilityLib3 EXCLUDE_IF_UNUSED)
>...
>
>so that if we have
>IF(USER_WANTS_PROJECTX)
>  ADD_SUBDIRECTORY(ProjectX)
>  # imagine that project X uses Utilility lib 1,3
>ENDIF(USER_WANTS_PROJECTX)
>
>IF(USER_WANTS_PROJECTY)
>  ADD_SUBDIRECTORY(ProjectY)
>  # imagine that project Y uses Utilility lib 2
>ENDIF(USER_WANTS_PROJECTY)
>
>etc etc
>
>If (from the GUI) we enable projectX, then 1,3 are built and are seen in the 
>IDE, if we enable Y, then 2 is seen, and so on, but when unused, they just 
>disappear completely from the build and IDE. I have about 10 projects and 
>about 5 utilites that are used in various combinations. I started writing 
>macros to hide the ones that are not used, but due to complex subdirectory 
>heirarchies it is painfull.
>
>Is there an easy way to do this, and if not, is it a good suggestion for an 
>addition?


It might be easier to do this on a target level rather than a directory level.
Something like this:
set_target_properties(foo PROPERTIES SKIP_IF_NOT_USED TRUE)

I think that would be possible, and maybe not too hard.


-Bill



>JB
>
>_______________________________________________
>CMake mailing list
>[email protected]
>http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to