<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Majo,<br>
    <br>
    We have a similar situation. I assume you want to use lib1 in proj2
    at build time, without doing a separate install. The way I solved
    this involves symbolic links, which AFAIK only work on Unix-like
    systems.<br>
    <br>
    We have an include directory inside the build directory that is
    populated with symbolic links to the diverse directories containing
    header files at cmake configure time. So, in your case there should
    be a symbolic link ${CMAKE_BINARY_DIR}/include/lib1 that points to
    ${CMAKE_SOURCE_DIR}/lib1/include. Then, somewhere at the top of your
    main CMakeLists.txt file you should add ${CMAKE_BINARY_DIR}/include
    to the include path using include_directories().<br>
    <br>
    Now proj2 should be able to locate lib1/lib1.h through the symbolic
    link, because ${CMAKE_BINARY_DIR}/include is in the -I<path>.<br>
    <br>
    Hope this helps.<br>
    <br>
    Regards,<br>
    Marcel Loose.<br>
    <br>
    <div class="moz-cite-prefix">On 17/06/14 13:46, majo huber wrote:<br>
    </div>
    <blockquote
cite="mid:CABnf4GvXL2S1j238EwhfYV6bsHJzwa9emSKAqwWQjE5xjZwxsg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi @all,<br>
        <br>
        I have a question regarding the organization of the header files
        of libraries.<br>
        I have a meta project with following structure:<br>
        <br>
        metaproj1/<br>
        |-- CMakeLists.txt<br>
        |-- lib1/<br>
            |-- include/<br>
            |   |<br>
            |   `-- lib1.h<br>
        |   |-- CMakeLists.txt<br>
        |   `-- lib1.c<br>
        `-- proj2/<br>
            |-- CMakeLists.txt<br>
            `-- main.c<br>
            <br>
        The meta project contains several other projects not mentioned
        here. <br>
        I would like to be able to do following things.<br>
        - the lib1 project should be usable in any other meta project
        without any changes to the library. E.g. in metaproject
        metaproj2<br>
        - install library header file to include/lib1/ in the system
        (e.g. /usr/local/include/lib1/lib1.h)<br>
        - include in any other source like that: #include
        <lib1/lib1.h> (see following examples)<br>
          - include the header from the system location it is installed
        in (e.g. /usr/local/include/lib1/lib1.h) ( with #include
        <lib1/lib1.h>)<br>
          - include the header from project proj2 with #include
        <lib1/lib1.h> (for builds from inside the meta project
        without installing the library)<br>
          <br>
        One approach I thought of is the following:<br>
        - copy all installed header files to a temp. build directory
        named lib1 <br>
        - set variable LIB1_INCLUDE_DIR to point to that directory<br>
        - use the variable with include_directories(${LIB1_INCLUDE_DIR})
        in proj2<br>
        <br>
        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?<br>
        <br>
        Now I wanted to know if there is any better solution to my
        problem?<br>
        <br>
        <br>
        Thanks in Advance,<br>
        majo<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </body>
</html>