[CMake] Build only what you need in third party libs

Brian Davis bitminer at gmail.com
Mon Dec 7 11:47:42 EST 2009


Yes this looks like an option.  Thanks for the lead.  It is not quite  
what I was expecting.

This seems specific to Boost Libraries.  Which brings up 2 questions:

Is there a generic way do this for any third party source tree?
Is there going to be CMAKE variable name resolution clash potential  
without namespace resolution within CMake (or is there already this  
problem or have I missed something)?

What I would like to do is set (please bear with me as I am a complete  
nube to CMake)

BUILD_PROJECTS=none

Then do

add_subdirectory(boost_source_dir)

project( my_exe )
add_executable( my_exe mysource.cpp )
add_library( boost_filesystem   SHARED)
#An IMPORTED library target references a library file located outside  
the project. No rules are generated to build it. <- Too bad about this  
last statement

or

add_dependencies( my_exe boost_filesystem )


Is there any mechanism for project level resolution of third party  
source targets such as in bjam boost//boost_filesystem

project
     : requirements <library>../build//boost_filesystem
       <library>/boost/system//boost_system
       <hardcode-dll-paths>true
     ;


project boost/filesystem
     : source-location ../src
     : usage-requirements # pass these requirement to dependents (i.e.  
users)
       <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
       <link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
     ;

And boost_filesystem's use:

project
     : requirements
       <library>/boost/filesystem//boost_filesystem
       <toolset>msvc:<asynch-exceptions>on
     ;

where some syntax like:

add_subdirectory(boost_source_dir PROJECT boost )

add_dependencies( my_exe boost//boost_filesystem )

or

add_library( boost//boost_filesystem   SHARED)


allowing the specification and namespace resolution of the 3rdParty  
(boost) library

I know above does not exist as my example question shows, but if it  
does in some other form what is it?

Brian

On Sat, Dec 5, 2009 at 3:45 PM, Mike Jackson <mike.jackson at bluequartz.net 
 > wrote:
I _think_ you _might_ be able to set the BUILD_PROJECTS to
"file_system;system" then do the "add_subdirectory()".
  Give it a shot and see what happens.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Sat, Dec 5, 2009 at 4:15 PM, Brian Davis <bitminer at gmail.com> wrote:
 >
 > I have used boost jam before and there was a mechanism to build  
only what
 > you need by specifying dependencies within the boost libraries.   
bjam would
 > then run off calculate deps and build only what I needed. In CMake  
is there
 > such a feature to specify a third party library and specify only  
the targets
 > you need to build as dependencies of my build target?
 >
 > i.e. can I use
 >
 > add_subdirectory( lib/3rdParty/Win32/boost-cmake-1_41_0 ./boost )
 >
 > then create a target that only uses say boost_filesystem and only  
have that
 > built? Or do I need to build the world to get a handful of needed  
dll's that
 > are actually used in my project?
 >
 > --
 > Brian J. Davis
 >
 >
 > _______________________________________________
 > 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
 >



-- 
Brian J. Davis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091207/9b5e3680/attachment.htm>


More information about the CMake mailing list