[CMake] RE: CMake Digest, Vol 17, Issue 27

Jonick, Kathy-P57450 Kathleen.Jonick at gdc4s.com
Mon Sep 26 12:12:29 EDT 2005


Hi David,

Well, that sort of worked.  Just moving the SUBDIRS down didn't seem to
help.  But if I did that in addition to listing the files in the
ADD_LIBRARY command rather than using a variable to do this, then it
worked.  Not sure why the variable setting was picking up the
subdirectories.

So the following now works:
INCLUDE_DIRECTORIES(../include . ../agent ../agent/mibgroup ../snmplib)

ADD_LIBRARY(netsnmpagents SHARED snmp_agent.c
.....
        mibgroup/agentx/agentx_config.c )

SUBDIRS( helpers mibgroup )
 
Thanks everyone!

Kathy

-----Original Message-----
From: cmake-bounces+kathleen.jonick=gdc4s.com at cmake.org
[mailto:cmake-bounces+kathleen.jonick=gdc4s.com at cmake.org] On Behalf Of
cmake-request at cmake.org
Sent: Monday, September 26, 2005 9:00 AM
To: cmake at cmake.org
Subject: CMake Digest, Vol 17, Issue 27

Send CMake mailing list submissions to
	cmake at cmake.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://www.cmake.org/mailman/listinfo/cmake
or, via email, send a message with subject or body 'help' to
	cmake-request at cmake.org

You can reach the person managing the list at
	cmake-owner at cmake.org

When replying, please edit your Subject line so it is more specific than
"Re: Contents of CMake digest..."


Today's Topics:

   1. Add subdir and library in CmakeList.txt (Karr, David A.)


----------------------------------------------------------------------

Message: 1
Date: Mon, 26 Sep 2005 11:42:02 -0400
From: "Karr, David A." <David.Karr at titan.com>
Subject: [CMake] Add subdir and library in CmakeList.txt
To: <cmake at cmake.org>
Message-ID: <57125C3FB6A12E45A7716E5F23C00D8401FB581C at bill-exch1>
Content-Type: text/plain;	charset="us-ascii"

I have a project on which we've used CMake to do something similar for
at least a couple of years now.  I see just two notable differences
between what we've done and what you want to do:

1. In the CMakeLists.txt file in the parent directory, our ADD_LIBRARY
command occurs _before_ the SUBDIRS command, not after.

2. We've never upgraded the version of CMake since installing it on this
project, so we're still on version 1.6.7.

This CMakeLists.txt worked in VC++ and in a Linux gcc environment.

Coincidentally, I just spent a few hours last week redesigning the
libraries of that project, as a result of which I moved the original
ADD_LIBRARY command from the parent directory into a new subdirectory.
It was always awkward having a library built in a directory above the
directories where other libraries were built, not just because of CMake,
and I was ready to take any excuse for not doing that any more.

David Karr


> From: "Jonick, Kathy-P57450" <Kathleen.Jonick at gdc4s.com>
> Subject: RE: [CMake] Add subdir and library in CmakeList.txt
> To: <cmake at cmake.org>
> Message-ID:
> 	<C7FCC5C93630AB4E80049ED163FFD2247BABC5 at AZ25EXM04.gddsi.com>
> Content-Type: text/plain;	charset="us-ascii"
> 
> File1.c is location in the current directory.  But it is looking in
the
> directory listed in the SUBDIRS command.  I wanted it to build those 
> directories, then create the library in the current directory.
> 
> Thanks!
> 
> Kathy
> 
> >Is it possible to include a SUBDIR list as well as a library in one
> CMakeList.txt file?
> >
> >I want to be able to build a library in the current directory, as
well
> as call the CMakeList.txt file in 2 subdirectories.  My CMakeList.txt 
> file looks like:
> >SUBDIRS(dir1 dir2)
> >
> >SET(SOURCES <file list> )
> >
> >ADD_LIBRARY(libname SHARED ${SOURCES})
> >
> >But when I run cmake, I get messages looking for the files listed in
> the subdirectories, rather than the current directory:
> >CMake Error: can not find file
> >/home/cmake_demo/current_dir/dir1/file1.c
> >
> >Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h++ .hm .hpp .hxx .in
.txx
> >
> >Is this possible?  If not, how do I build the library in current dir?




------------------------------

_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake


End of CMake Digest, Vol 17, Issue 27
*************************************


More information about the CMake mailing list