[CMake] Re: ADD_SUBDIRECTORY and EXCLUDE_FROM_ALL

DA atdbds at yahoo.com
Sun Jan 27 20:09:33 EST 2008


Hello again,

Sorry what I stated before does not work either. I thought it did, but it does 
not. EXCLUDE_FROM_ALL does not seem to work for me. Perhaps I am 
mis-understanding  its intent or I am doing something else. Hope someone can 
provide some insight about this issue. Thanks.

Here is what the top level CMakeLists.txt file looks like:

PROJECT (plugins)

ADD_SUBDIRECTORY (tools)
ADD_SUBDIRECTORY (filters)
ADD_SUBDIRECTORY (designer EXCLUDE_FROM_ALL)

and here is the CMakeLists.txt file for the designer sub-directory:

PROJECT(designer)

SET(QT_USE_QTDESIGNER ON)
INCLUDE(${QT_USE_FILE})

SET(LIBS_DIR ../../lib)
SET(EXTERNALS_DIR ../../externals)
SET (CMAKE_CURRENT_BINARY_DIR ${PROJECT_BINARY_DIR}/GeneratedFiles)

FILE (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES (${LIBS_DIR} ${EXTERNALS_DIR}/common 
${EXTERNALS_DIR}/Img_Base ${CMAKE_CURRENT_BINARY_DIR})

SET ( Sources	<list of source files here> )

SET ( Headers 	<list of header files here> )

SET ( Forms <list of Qt UI files here> )

QT4_WRAP_UI(uifiles ${Forms})
QT4_WRAP_CPP(mocFiles ${Headers})

ADD_DEFINITIONS (-Wall -DQT_PLUGIN -DQDESIGNER_EXPORT_WIDGETS)

ADD_LIBRARY(designer SHARED ${Sources} ${mocFiles} ${uifiles})
SET_TARGET_PROPERTIES (designer PROPERTIES VERSION 3.0.0 SOVERSION 3.0.0)
TARGET_LINK_LIBRARIES (designer ${QT_LIBRARIES})

INSTALL (TARGETS designer
               LIBRARY DESTINATION lib/plugins/designer
               PERMISSIONS OWNER_WRITE OWNER_READ GROUP_WRITE GROUP_READ
               OPTIONAL)



On Sunday 27 January 2008 19:51:46 you wrote:
> Hi,
>
> I figured this out on my own. Apparently if the CMakeLists.txt file in the
> mentioned sub-directoy contains a INSTALL rule, the EXCLUDE_FROM_ALL
> parameter does not apply. If I add the "OPTIONAL" directive to the INSTALL
> target, then all works as advertised.
>
> The question I now have is that should it matter if the CMakeLists.txt of
> the subdirectory I include contains an INSTALL target ? Somehow to me it
> does not make sense. When I added EXCLUDE_FROM_ALL, I expected that
> directory to be excluded regardless of the target I built: "make all" or
> "make install". Otherwise, it would be nice if the documentation for
> ADD_SUBDIRECTORY stated this little fact...
>
> Thanks.
>
> On Sunday 27 January 2008 13:51:30 you wrote:
> > Hello,
> >
> > The documentation for ADD_SUBDIRECTORY suggests states the following:
> >
> > If the EXCLUDE_FROM_ALL argument is provided then this subdirectory will
> > not be included in build by default. Users will have to explicitly start
> > a build in the generated output directory. This is useful for having
> > cmake create a build system for a set of examples in a project. One would
> > want cmake to generate a single build system for all the examples, but
> > one may not want the targets to show up in the main build system.
> >
> > And I have a add_subdirectory entry that includes the EXCLUDE_FROM_ALL
> > directive:
> >
> > ADD_DIRECTORY (designer EXCLUDE_FROM_ALL)
> >
> > but the directive is ignored and the sub-directory always get built by
> > default. I am using cmake 2.4.7.  Does anyone else experience this
> > problem ? Is this a known issue already addressed in a recent fix ?
> >
> > Thanks,
> > DA


More information about the CMake mailing list