Re: [CMake] Couple of library/link questions

2012-03-21 Thread Oliver kfsone Smith

Andreas Pakulat said the following on 3/20/2012 5:21 PM:

- The makefiles I'm basing this on build libevent_core.lib,
libevent_extras.lib and then libevent.lib which is basically the two
previous libraries merged.

I wanted to do:

ADD_LIBRARY(libevent_core ${CoreSrcFiles})
ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
ADD_LIBRARY(libevent)
TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)

but this generates a warning/error,  listing the two libraries in

Whats the error? It should just work.
I mis-spoke; it gives a /warning/ for the ADD_LIBRARY(libevent) with no 
source files, warning that it is usually an error in the CMakeLists.txt 
file.


- Oliver

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Couple of library/link questions

2012-03-20 Thread Oliver Smith
I'm trying to make a CMakeLists for libevent, and had a couple of 
questions that would make it a bit cleaner:


- Other than using a macro to do { add_executable(...) 
target_link_libraries(...) } is there a /clean/ way to make everything 
in a subdirectory automatically link a given library?


- The makefiles I'm basing this on build libevent_core.lib, 
libevent_extras.lib and then libevent.lib which is basically the two 
previous libraries merged.


I wanted to do:

ADD_LIBRARY(libevent_core ${CoreSrcFiles})
ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
ADD_LIBRARY(libevent)
TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)

but this generates a warning/error,  listing the two libraries in 
add_library doesn't work either.


So for now I have

ADD_LIBRARY(libevent_core ${CoreSrcFiles})
ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
ADD_LIBRARY(libevent ${CoreSrcFiles} ${ExtraSrcFiles})

but that's clumsy :)

- Oliver

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Couple of library/link questions

2012-03-20 Thread Andreas Pakulat
On 20.03.12 14:01:31, Oliver Smith wrote:
 I'm trying to make a CMakeLists for libevent, and had a couple of
 questions that would make it a bit cleaner:
 
 - Other than using a macro to do { add_executable(...)
 target_link_libraries(...) } is there a /clean/ way to make
 everything in a subdirectory automatically link a given library?

No.

 - The makefiles I'm basing this on build libevent_core.lib,
 libevent_extras.lib and then libevent.lib which is basically the two
 previous libraries merged.
 
 I wanted to do:
 
 ADD_LIBRARY(libevent_core ${CoreSrcFiles})
 ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
 ADD_LIBRARY(libevent)
 TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)
 
 but this generates a warning/error,  listing the two libraries in

Whats the error? It should just work.

Andreas

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Couple of library/link questions

2012-03-20 Thread Jean-Christophe Fillion-Robin
Hi Olivier,

Assuming you have not set the flag, BUILD_SHARED_LIBS [1] set to TRUE, I
will  consider you are building static libraries. If this last statement is
valid, it seems your approach is the right one.

I would also recommend you to read the following entry:
http://vtk.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F

Hth
Jc

[1]
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:BUILD_SHARED_LIBS

On Tue, Mar 20, 2012 at 3:01 PM, Oliver Smith osm...@playnet.com wrote:

  I'm trying to make a CMakeLists for libevent, and had a couple of
 questions that would make it a bit cleaner:

 - Other than using a macro to do { add_executable(...)
 target_link_libraries(...) } is there a *clean* way to make everything in
 a subdirectory automatically link a given library?

 - The makefiles I'm basing this on build libevent_core.lib,
 libevent_extras.lib and then libevent.lib which is basically the two
 previous libraries merged.

 I wanted to do:

 ADD_LIBRARY(libevent_core ${CoreSrcFiles})
 ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
 ADD_LIBRARY(libevent)
 TARGET_LINK_LIBRARIES(libevent libevent_core libevent_extras)

 but this generates a warning/error,  listing the two libraries in
 add_library doesn't work either.

 So for now I have

 ADD_LIBRARY(libevent_core ${CoreSrcFiles})
 ADD_LIBRARY(libevent_extras ${ExtraSrcFiles})
 ADD_LIBRARY(libevent ${CoreSrcFiles} ${ExtraSrcFiles})

 but that's clumsy :)

 - Oliver


 --

 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake




-- 
+1 919 869 8849
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake