[Cmake] PROJECT command

Bill Hoffman bill.hoffman at kitware.com
Fri Aug 9 09:21:24 EDT 2002


This is not a change to CMake.   The PROJECT command has always changed
the PROJECT_NAME from that point down.   My question is why does the
sub project care if it is part of a larger project or not?   For example,
the jpeg library in VTK is a PROJECT(VTKJPEG), and can be compiled by itself, but
also can be part of VTK.   

If you want the sub project to know it is part of a larger project, then set 
a variable in the cmakelist file above the sub project,  PART_OF_PROJECT xxx,
then check for that in your sub project.   

-Bill



At 09:01 AM 8/9/2002 -0400, Miller, James V (Research) wrote:
>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
>
><mailto:millerjv at research.ge.com>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/a1918ed0/attachment.html>


More information about the CMake mailing list