Hi @all,

I have a question regarding the organization of the header files of
libraries.
I have a meta project with following structure:

metaproj1/
|-- CMakeLists.txt
|-- lib1/
    |-- include/
    |   |
    |   `-- lib1.h
|   |-- CMakeLists.txt
|   `-- lib1.c
`-- proj2/
    |-- CMakeLists.txt
    `-- main.c

The meta project contains several other projects not mentioned here.
I would like to be able to do following things.
- the lib1 project should be usable in any other meta project without any
changes to the library. E.g. in metaproject metaproj2
- install library header file to include/lib1/ in the system (e.g.
/usr/local/include/lib1/lib1.h)
- include in any other source like that: #include <lib1/lib1.h> (see
following examples)
  - include the header from the system location it is installed in (e.g.
/usr/local/include/lib1/lib1.h) ( with #include <lib1/lib1.h>)
  - include the header from project proj2 with #include <lib1/lib1.h> (for
builds from inside the meta project without installing the library)

One approach I thought of is the following:
- copy all installed header files to a temp. build directory named lib1
- set variable LIB1_INCLUDE_DIR to point to that directory
- use the variable with include_directories(${LIB1_INCLUDE_DIR}) in proj2

I know that there is a mechanism called find_package(), but if I am correct
this does not allow to have a different directory inside the library for
the headers (include) and as installation path (lib1/), right?

Now I wanted to know if there is any better solution to my problem?


Thanks in Advance,
majo
-- 

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

Reply via email to