[Cmake] PROJECT command

Miller, James V (Research) millerjv at crd.ge.com
Fri Aug 9 09:01:43 EDT 2002


What is CMake's desired behavior if it finds two "PROJECT" commands within a directory tree?
 
For instance, the toplevel CMakeLists.txt file has a PROJECT command and a subdirectory
also has a PROJECT command. The motivation here is that I would like to have a subdirectory
that can be built as part of the toplevel project, or it can be itself.
 
I thought in previous versions of CMake, if it found subsequent PROJECT commands they were
ignored.  In CMake 1.4.3, it appears as though the second PROJECT command overrides the
${PROJECT_NAME} (at least for the subdirectory and its descendents).
 
I suspect the answer is going to be "it hurts when you do that".  So let me ask the question a 
different way:
 
What is the currently suggested mechanism for setting up a subdirectory so that it can be
built as part of a project or as a standalone project. I want to be able to detect whether the
directory is part of a bigger project or not.  My attempt at the CMakeLists.txt for the subdirectory
was something like
 
PROJECT(subproject)
 
IF (${PROJECT_NAME} MATCHES "subproject")
# this subdirectory is being built as a standalone project
ELSE ()
# this subdirectory is being built as part of a bigger project
ENDIF ()
 
 

 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Jim Miller 
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv at research.ge.com <mailto:millerjv at research.ge.com> 

james.miller at research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005, 
Cell: (518) 505-7065, Fax: (518) 387-6981 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20020809/f99b2b4a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: James Miller (E-mail).vcf
Type: application/octet-stream
Size: 606 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20020809/f99b2b4a/attachment.obj>


More information about the CMake mailing list