Re: [CMake] Question regarding source tree structure and how to find libraries easily within that structure

2012-03-05 Thread Michael Hertling
On 03/04/2012 11:01 AM, Andreas Guther wrote:
> Hello,
> 
> thanks for the responses. The problem I have is, that we have more than one 
> application in the directory. So if I put an CMakeLists.txt in the Src 
> directory I do not have the choice (only by options). I would prefer a 
> solution where I change into the application directory I want to build and 
> create workspace etc. from there. The created workspace should then also 
> build all necessary libraries for the application.
> 
> Any ideas on this?

In Application_1/CMakeLists.txt, e.g., do:

SET(Library_1_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../Library_1
CACHE PATH "Library_1 source directory")
...
ADD_SUBDIRECTORY(${Library_1_SOURCE_DIR} Library_1)

Do the same for Library_2 and every other prerequisite project which

- has a source tree external to Application_1
- you want to be built along with the latter

and finally: TARGET_LINK_LIBRARIES(Application_1 Library_1 ...)

If the fallback value of Library_1_SOURCE_DIR once doesn't suit, you
can set it on the command line or in the GUI before (re)configuring.

Regards,

Michael
--

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] Question regarding source tree structure and how to find libraries easily within that structure

2012-03-04 Thread Andreas Guther
Hello,

thanks for the responses. The problem I have is, that we have more than one 
application in the directory. So if I put an CMakeLists.txt in the Src 
directory I do not have the choice (only by options). I would prefer a solution 
where I change into the application directory I want to build and create 
workspace etc. from there. The created workspace should then also build all 
necessary libraries for the application.

Any ideas on this?

Kind regards,
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] Question regarding source tree structure and how to find libraries easily within that structure

2012-02-29 Thread Carlton Henderson
Hi Andreas,I too am new to CMake, but let me take a crack at this... someone correct me if there's a better way.You shouldn't need a find module. You only need them when you're including libraries that CMake doesn't already know the location of. Since you're building Library_1 in CMake you can just give the library target name directly to target_link_libraries.Assuming you have:Source/CMakeLists.txt    ...    add_subdirectory(Library_1)    add_subdirectory(Application_1)Source/Library_1/CMakeLists.txt    add_library(Library_1 then you can simply do this:Source/Application_1/CMakeLists.txt    add_executable( Application_1 app1.cpp )    target_link_libraries( Application_1 Library_1 )    # That said, I'm not quite sure the nicest way to include_directories of said library.    # I've been using this:    include_directories( "${PROJECT_SOURCE_DIR}/Library_1" )Hope this helps,-Carl-cmake-boun...@cmake.org wrote: -To: cmake@cmake.orgFrom: "m.hergarden" Sent by: cmake-boun...@cmake.orgDate: 02/29/2012 01:50AMSubject: Re: [CMake] Question regarding source tree structure and how to find libraries easily within that structure
  

  
  
On 02/26/2012 09:18 AM, Andreas Guther wrote:

  Hello,I'm justing starting to learn/use CMake and I have a question regarding the usage of it in regards of source tree structure and library usage.I have the following folder structure:Root	Bin		Win32X86Debug		Win32X86Release		...	Lib		Win32X86Debug		Win32X86Release		...	Source		ace		Application_1		Application_2		boost		Library_1		Library_2		Library_3		...	Tools		…I'd like to point out the structure within "Source". In the source directory there are libraries that may be used by one or more applications. That means for example that "Application_1" may use "Library_1" and "Library_3" and "Application_2" may use "Library_1" and "Library_2".I have currently no idea how I should solve this without creating a find module for every library in the tree. Is there any other solution than creating find modules I can use?If there is really no other (good) solution than creating find modules, is it possible to place the find modules (Library_n.cmake files, right?) within the library folders? I ask this, because I think it would make it much more easy to maintain them.Kind regards,Andreas --Powered by www.kitware.comVisit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.htmlPlease keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQFollow this link to subscribe/unsubscribe:http://www.cmake.org/mailman/listinfo/cmake

Is there a reason you can't use the
  'include_directories' and 'link_directories' commands to add the
  correct linkpaths?
  
  Micha
  

  

--Powered by www.kitware.comVisit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.htmlPlease keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQFollow this link to subscribe/unsubscribe:http://www.cmake.org/mailman/listinfo/cmake
--

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] Question regarding source tree structure and how to find libraries easily within that structure

2012-02-28 Thread m.hergarden

On 02/26/2012 09:18 AM, Andreas Guther wrote:

Hello,

I'm justing starting to learn/use CMake and I have a question regarding the 
usage of it in regards of source tree structure and library usage.

I have the following folder structure:

Root
Bin
Win32X86Debug
Win32X86Release
...
Lib
Win32X86Debug
Win32X86Release
...
Source
ace
Application_1
Application_2
boost
Library_1
Library_2
Library_3
...
Tools
…

I'd like to point out the structure within "Source". In the source directory there are libraries that may be used by one or more 
applications. That means for example that "Application_1" may use "Library_1" and "Library_3" and 
"Application_2" may use "Library_1" and "Library_2".

I have currently no idea how I should solve this without creating a find module 
for every library in the tree. Is there any other solution than creating find 
modules I can use?
If there is really no other (good) solution than creating find modules, is it 
possible to place the find modules (Library_n.cmake files, right?) within the 
library folders? I ask this, because I think it would make it much more easy to 
maintain them.

Kind regards,
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
Is there a reason you can't use the 'include_directories' and 
'link_directories' commands to add the correct linkpaths?


Micha

--

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] Question regarding source tree structure and how to find libraries easily within that structure

2012-02-26 Thread Andreas Guther
Hello,

I'm justing starting to learn/use CMake and I have a question regarding the 
usage of it in regards of source tree structure and library usage.

I have the following folder structure:

Root
Bin
Win32X86Debug
Win32X86Release
...
Lib
Win32X86Debug
Win32X86Release
...
Source
ace
Application_1
Application_2
boost
Library_1
Library_2
Library_3
...
Tools
…

I'd like to point out the structure within "Source". In the source directory 
there are libraries that may be used by one or more applications. That means 
for example that "Application_1" may use "Library_1" and "Library_3" and 
"Application_2" may use "Library_1" and "Library_2".

I have currently no idea how I should solve this without creating a find module 
for every library in the tree. Is there any other solution than creating find 
modules I can use?
If there is really no other (good) solution than creating find modules, is it 
possible to place the find modules (Library_n.cmake files, right?) within the 
library folders? I ask this, because I think it would make it much more easy to 
maintain them.

Kind regards,
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