[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] "Emulate" a package result (find_package)
From:       r2d2leboss () voila ! fr
Date:       2015-03-28 22:00:52
Message-ID: 1685034455.79291427580052912.JavaMail.www () wwinf7130
[Download RAW message or body]

Hi,

We develop a library that we will call LIBRARY. To compile this library, we use CMake \
(of course :) ). This library include multiple components, like Boost system,  i.e. \
there are few add_library commands. This library produce LIBRARY_COMPONENTS_1, \
LIBRARY_COMPONENTS_2, LIBRARY_COMPONENTS_3 (each  component is a static or shared \
library, some both). At the end, user execute "make install" to merge all include \
dirs in "include/" and all components in "lib/". This  project include a \
FindLIBRARY.cmake file to use this library in another project.

We have modules, MODULE_1, MODULE_2, ... MODULE_N. Each module use some components of \
LIBRARY, maybe LIBRARY_COMPONENTS_1,  LIBRARY_COMPONENTS_2 or both... To compile \
MODULE_1, they need to compile LIBRARY first (separately) then module CMakeLists.txt \
will use  FindLIBRARY.cmake to link to components. This one works well.

Now, we would like to make something better. We have a project PROJECT with few \
modules (not all) and we would like to compile automatically, i.e. we would  like a \
top level CMakeLists.txt which compile LIBRARY and MODULE_1, MODULE_2, MODULE_3... 

Our idea was to use add_subdirectory but modules will try to search LIBRARY and they \
will not find the library because it's not still compiled... So, how to "emulate"  \
find_package result for LIBRARY ? Bad idea (I think), is to set LIBRARY-FOUND to \
true, manually include dirs (a pain because library is not installed) and it will not \
 prevent to library upgrade (maybe that tomorrow it will have a new components, so a \
new include dir to add). 

Do you have any idea to build our top level PROJECT CMakeLists.txt ?

Thank you,

Jean

PROJECT/
CMakeLists.txt
libs/
LIBRARY/
CMakeLists.txt
...
modules/
MODULE_1/
FindLIBRARY.cmake
CMakeLists.txt
...
MODULE_2
FindLIBRARY.cmake
CMakeLists.txt
...
MODULE_2
FindLIBRARY.cmake
CMakeLists.txt
...
___________________________________________________________
Mode, hifi, maison,… J'achète malin. Je compare les prix avec Voila.fr \
                http://shopping.voila.fr/
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic