[CMake] using cmake on windows - query on existing targets

Chauhan, Vikas vikas.chauhan at anritsu.com
Sun Jan 10 19:57:46 EST 2010



> -----Original Message-----
> From: Alexander Neundorf [mailto:a.neundorf-work at gmx.net]
> Sent: 06 January 2010 21:24
> To: cmake at cmake.org
> Cc: Chauhan, Vikas
> Subject: Re: [CMake] using cmake on windows - query on existing
targets
> 
> On Wednesday 06 January 2010, Chauhan, Vikas wrote:
> > Hi,
> >
> > I am quite new to using cmake and at the moment I am trying to find
my
> > way through it.
> > I was wondering how we can query different targets on windows when
using
> > cmake.
> > For example: I may have a set of separate directories(each
containing a
> > project) and from the top level root directory, I want to
selectively
> > build a subset of projects.
> 
> in KDE we have the macro
> macro_optional_add_subdirectory()
>
http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/MacroOptionalAddSu
> bdirectory.cmake?revision=940658&view=markup
> 
> E.g. if you do
> macro_optional_add_subdirectory(project1)
> 
> the subdir project1/ will be added like with normal
add_subdirectory(), but
> additionally you'll have a cmake option "BUILD_project1", which you
can
> enable and disable, and when disabled, the directory will not be
added.
> 
> > How can I do it on the command line ? Also, can I query the list of
> > targets/projects from the command line?
> 
> E.g. with the approach above, you can use cmake-gui or ccmake to have
a look
> at the available options.
> 
> Does that help ?
> 
> Alex

Actually, when I used the macro I found that though this macro gives a
useful functionality it is not exactly what I wanted.

What I want to do can be illustrated the following example:
I have a main project/dir - projectSystem
I have three component/dir - projectcomponent1, projectcomponent2,
projectcomponent3.

Now on windows from the directory where the cmake generated files are
present, at present I issue a  command : 
cmake --build PATH_TO_PROJECTSYSTEM
This builds the projectSystem alongwith projectComponent1,
projectComponent2 & projectComponent3.

Now, I want to do two things on command window(from the dir where cmake
build files are generated):
1. Query the list of sub-targets(components) available. In this case the
result is a list
projectComponent1
projectComponent2
projectComponent3
2. Now based on the list in 1, optionally build any component. For
example issue a command:

cmake --build projectComponent1

Can we achieve this? Or is it asking for too much :)

Thanks,
Vikas


More information about the CMake mailing list