On 8/14/07, Jon W <[EMAIL PROTECTED]> wrote:
> On 8/14/07, Filip Brcic <[EMAIL PROTECTED]> wrote:
> > Дана уторак 14 август 2007, Jon W је написао(ла):
> > > > > > Is it possible to have multiple CMakeLists.txt files within the same
> > > > > > directory? (We have projects that span/share multiple directories,
> > > > > > and currently all of the vcproj files are within a single directory
> > > > > > for easy editing.)
> > > > > >
> > > > > > Or, is the suggested route to create a directory structure such as,
> > > > > >
> > > > > > /
> > > > > > src/foo/foo.cxx
> > > > > > /apple/apple.cxx
> > > > > >
> > > > > > cmake/foo/CMakeLists.txt
> > > > > > /apple/CMakeLists.txt
> > > >
> > > > Every CMakeLists.txt file should have it's target. If you wish to make
> > > > libraries out of every directory and then link them with main() in the
> > > > top directory then use separate CMakeLists.txt.
> > > >
> > > > Filip Brcic <[EMAIL PROTECTED]>
> > >
> > > I'm building foo.dll, apple.dll, some.exe, from which the source is
> > > scattered throughout the src directory.  There are no foo or apple
> > > directories, so I can't put a CMakeLists.txt file in those specific
> > > directories.  What I have been doing is to create a main cmake
> > > directory (next to src) that then has a directory based upon the
> > > dll/exe name (foo, apple) with a CMakeLists.txt inside.
> > >
> > > src/
> > > cmake/
> > >           apple/CMakeLists.txt
> > >           foo/CMakeLists.txt
> > >
> > > One of the developers was hoping that we could bypass the extra
> > > directory structure and have a general directory that has all of the
> > > dll/exe cmake files inside.  For example,
> > >   cmakefiles/
> > >                   CMakeLists_apple.txt
> > >                   CMakeLists_foo.txt
> > >
> > > But, this doesn't sound as though it will work very well.  Thank you
> > > for your help.
> > >
> > > -Jon
> >
> > But you can do just that as Mike Jackson suggested. Make your
> > cmakefiles/CMakeLists_*.txt files and then include them in some master
> > CMakeLists.txt, possibly with IF(something) arround that.
> >
> > --
> > Filip Brcic <[EMAIL PROTECTED]>
>
> That sounds like it would work fine if all of the options are the
> same, but may be difficult to separate compiler options,
> link_directories, include paths, and custom commands, per project.
> I'm guessing that every CMakeLists_project.txt would then need to IF
> block every listing that isn't specifically linked to that project's
> dll/exe.
>
> -Jon
>

Probably what you should be doing is to have all the general cmake
setup stuff (general sources, binary locations) setup in your top
level CMake file. Then you will have Apple.cmake (note the extension..
) and in there you start listing all your apple specific compiler
options and other options. In those platform specifc files you also
define a variable PLATFORM_SRCS that would have your list of platform
specific sources in it. In your Main CMakeLists.txt file you then do:

SET (SRCS foo.cpp)

IF (APPLE)
INCLUDE (Apple.cmake)
ENDIF(APPLE)

IF (WIN32)
INCLUDE (Win32.cmake)
ENDIF(WIN32)

SET (SRCS ${SRCS} ${PLATFORM_SRCS} )

ADD_LIBRARY (foo SHARED ${SRCS} )

The gets rid of all the extra directories. Does this help?
-- 
Mike Jackson
imikejackson _at_ gee-mail dot com
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to