[ 
https://issues.apache.org/jira/browse/PROTON-2738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nikita Akatiev updated PROTON-2738:
-----------------------------------
    Description: 
Hi team,

Here is how I currently build qpid-proton (on RHEL 8.3):
{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton
~/qpid-proton/build/$ make -j && make install
{noformat}

Now, I really wanted to change {{include}} directory to something else in my 
install layout. So, I tried to set {{CMAKE_INSTALL_INCLUDEDIR}} (as per 
[https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)|https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)]
 – qpid build ignored it, and even gave me a warning at configuration time:

{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DCMAKE_INSTALL_INCLUDEDIR=include64
...
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_INSTALL_INCLUDEDIR
...
~/qpid-proton/build/$ make -j && make install
...
~/qpid-proton/build/$ ls ~/proton
include  lib64  share
{noformat}

I browsed through CMakeLists a little bit, found {{INCLUDE_INSTALL_DIR}} which 
sounded like something I would need. Well, I tried to set it and got soooo many 
errors:

{noformat}
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DINCLUDE_INSTALL_DIR=include64
CMake Error in c/CMakeLists.txt:
  Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.


CMake Error in c/CMakeLists.txt:
  Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.Target "qpid-proton"
  INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the source directory.


CMake Error in c/CMakeLists.txt:
  Target "qpid-proton-core" INTERFACE_INCLUDE_DIRECTORIES property contains
  path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.
{noformat}

Checked on 0.36 that I use and on 
[main@e63708|https://github.com/apache/qpid-proton/commit/e637082ac62c6caefbc3ac94ef01e98a3c0b5902],
 error still exists. I browsed cache variables just to understand where my 
include64 value was coming into, and found that CMake saved my overriden 
{{INCLUDE_INSTALL_DIR}} as an absolute path to build directory:

{noformat}
~/qpid-proton/build/$ grep include64 CMakeCache.txt
INCLUDE_INSTALL_DIR:PATH=/export/home/nikita.akatiev/qpid-proton/build/include64
INSTALL_INCLUDE_DIR:UNINITIALIZED=include64
{noformat}

AFAIU this is due to the variable type (PATH) -- it is even a documented 
behaviour for {{set()}} operation: 
[link|https://cmake.org/cmake/help/latest/command/set.html#:~:text=Furthermore%2C%20if%20the%20%3Ctype%3E%20is%20PATH%20or%20FILEPATH%20and%20the%20%3Cvalue%3E%20provided%20on%20the%20command%20line%20is%20a%20relative%20path%2C%20then%20the%20set%20command%20will%20treat%20the%20path%20as%20relative%20to%20the%20current%20working%20directory%20and%20convert%20it%20to%20an%20absolute%20path.].
 As a workaround, explicitly specifying variable type as STRING seems to work 
correctly:

{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DINCLUDE_INSTALL_DIR:STRING=include64
...
~/qpid-proton/build/$ make -j && make install
...
~/qpid-proton/build/$ ls ~/proton
include64  lib64  share
{noformat}

Maybe setting {{INCLUDE_INSTALL_DIR}} as a STRING variable here 
https://github.com/apache/qpid-proton/blob/e637082ac62c6caefbc3ac94ef01e98a3c0b5902/CMakeLists.txt#L249
 would help, or you could just use more standard GNUInstallDirs module which 
already handles that.

  was:
Hi team,

Here is how I currently build qpid-proton (on RHEL 8.3):
{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton
~/qpid-proton/build/$ make -j && make install
{noformat}

Now, I really wanted to change {{include}} directory to something else in my 
install layout. So, I tried to set {{CMAKE_INSTALL_INCLUDEDIR}} (as per 
[https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)|https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)]
 – qpid build ignored it, and even gave me a warning at configuration time:

{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DCMAKE_INSTALL_INCLUDEDIR=include64
...
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_INSTALL_INCLUDEDIR
...
~/qpid-proton/build/$ make -j && make install
...
~/qpid-proton/build/$ ls ~/proton
include  lib64  share
{noformat}

I browsed through CMakeLists a little bit, found {{INCLUDE_INSTALL_DIR}} which 
sounded like something I would need. Well, I tried to set it and got soooo many 
errors:

{noformat}
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DINCLUDE_INSTALL_DIR=include64
CMake Error in c/CMakeLists.txt:
  Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.


CMake Error in c/CMakeLists.txt:
  Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.Target "qpid-proton"
  INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the source directory.


CMake Error in c/CMakeLists.txt:
  Target "qpid-proton-core" INTERFACE_INCLUDE_DIRECTORIES property contains
  path:

    "/export/home/nikita.akatiev/qpid-proton/build/include64"

  which is prefixed in the build directory.
{noformat}

Reproduces on 
[main@e63708|https://github.com/apache/qpid-proton/commit/e637082ac62c6caefbc3ac94ef01e98a3c0b5902].
 I browsed cache variables just to understand where my include64 value was 
coming into, and found that CMake saved my overriden {{INCLUDE_INSTALL_DIR}} as 
an absolute path to build directory:

{noformat}
~/qpid-proton/build/$ grep include64 CMakeCache.txt
INCLUDE_INSTALL_DIR:PATH=/export/home/nikita.akatiev/qpid-proton/build/include64
INSTALL_INCLUDE_DIR:UNINITIALIZED=include64
{noformat}

AFAIU this is due to the variable type (PATH) -- it is even a documented 
behaviour for {{set()}} operation: 
[link|https://cmake.org/cmake/help/latest/command/set.html#:~:text=Furthermore%2C%20if%20the%20%3Ctype%3E%20is%20PATH%20or%20FILEPATH%20and%20the%20%3Cvalue%3E%20provided%20on%20the%20command%20line%20is%20a%20relative%20path%2C%20then%20the%20set%20command%20will%20treat%20the%20path%20as%20relative%20to%20the%20current%20working%20directory%20and%20convert%20it%20to%20an%20absolute%20path.].
 As a workaround, explicitly specifying variable type as STRING seems to work 
correctly:

{noformat}
~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
-DINCLUDE_INSTALL_DIR:STRING=include64
...
~/qpid-proton/build/$ make -j && make install
...
~/qpid-proton/build/$ ls ~/proton
include64  lib64  share
{noformat}

Maybe setting {{INCLUDE_INSTALL_DIR}} as a STRING variable here 
https://github.com/apache/qpid-proton/blob/e637082ac62c6caefbc3ac94ef01e98a3c0b5902/CMakeLists.txt#L249
 would help, or you could just use more standard GNUInstallDirs module which 
already handles that.


> CMake configure fails when trying to override install layout
> ------------------------------------------------------------
>
>                 Key: PROTON-2738
>                 URL: https://issues.apache.org/jira/browse/PROTON-2738
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: build, proton-c
>            Reporter: Nikita Akatiev
>            Priority: Major
>
> Hi team,
> Here is how I currently build qpid-proton (on RHEL 8.3):
> {noformat}
> ~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
> ~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton
> ~/qpid-proton/build/$ make -j && make install
> {noformat}
> Now, I really wanted to change {{include}} directory to something else in my 
> install layout. So, I tried to set {{CMAKE_INSTALL_INCLUDEDIR}} (as per 
> [https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)|https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)]
>  – qpid build ignored it, and even gave me a warning at configuration time:
> {noformat}
> ~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
> ~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
> -DCMAKE_INSTALL_INCLUDEDIR=include64
> ...
> CMake Warning:
>   Manually-specified variables were not used by the project:
>     CMAKE_INSTALL_INCLUDEDIR
> ...
> ~/qpid-proton/build/$ make -j && make install
> ...
> ~/qpid-proton/build/$ ls ~/proton
> include  lib64  share
> {noformat}
> I browsed through CMakeLists a little bit, found {{INCLUDE_INSTALL_DIR}} 
> which sounded like something I would need. Well, I tried to set it and got 
> soooo many errors:
> {noformat}
> ~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
> -DINCLUDE_INSTALL_DIR=include64
> CMake Error in c/CMakeLists.txt:
>   Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:
>     "/export/home/nikita.akatiev/qpid-proton/build/include64"
>   which is prefixed in the build directory.
> CMake Error in c/CMakeLists.txt:
>   Target "qpid-proton" INTERFACE_INCLUDE_DIRECTORIES property contains path:
>     "/export/home/nikita.akatiev/qpid-proton/build/include64"
>   which is prefixed in the build directory.Target "qpid-proton"
>   INTERFACE_INCLUDE_DIRECTORIES property contains path:
>     "/export/home/nikita.akatiev/qpid-proton/build/include64"
>   which is prefixed in the source directory.
> CMake Error in c/CMakeLists.txt:
>   Target "qpid-proton-core" INTERFACE_INCLUDE_DIRECTORIES property contains
>   path:
>     "/export/home/nikita.akatiev/qpid-proton/build/include64"
>   which is prefixed in the build directory.
> {noformat}
> Checked on 0.36 that I use and on 
> [main@e63708|https://github.com/apache/qpid-proton/commit/e637082ac62c6caefbc3ac94ef01e98a3c0b5902],
>  error still exists. I browsed cache variables just to understand where my 
> include64 value was coming into, and found that CMake saved my overriden 
> {{INCLUDE_INSTALL_DIR}} as an absolute path to build directory:
> {noformat}
> ~/qpid-proton/build/$ grep include64 CMakeCache.txt
> INCLUDE_INSTALL_DIR:PATH=/export/home/nikita.akatiev/qpid-proton/build/include64
> INSTALL_INCLUDE_DIR:UNINITIALIZED=include64
> {noformat}
> AFAIU this is due to the variable type (PATH) -- it is even a documented 
> behaviour for {{set()}} operation: 
> [link|https://cmake.org/cmake/help/latest/command/set.html#:~:text=Furthermore%2C%20if%20the%20%3Ctype%3E%20is%20PATH%20or%20FILEPATH%20and%20the%20%3Cvalue%3E%20provided%20on%20the%20command%20line%20is%20a%20relative%20path%2C%20then%20the%20set%20command%20will%20treat%20the%20path%20as%20relative%20to%20the%20current%20working%20directory%20and%20convert%20it%20to%20an%20absolute%20path.].
>  As a workaround, explicitly specifying variable type as STRING seems to work 
> correctly:
> {noformat}
> ~/qpid-proton/$ rm -rf ./build/ && mkdir ./build/ && cd ./build/
> ~/qpid-proton/build/$ cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/proton 
> -DINCLUDE_INSTALL_DIR:STRING=include64
> ...
> ~/qpid-proton/build/$ make -j && make install
> ...
> ~/qpid-proton/build/$ ls ~/proton
> include64  lib64  share
> {noformat}
> Maybe setting {{INCLUDE_INSTALL_DIR}} as a STRING variable here 
> https://github.com/apache/qpid-proton/blob/e637082ac62c6caefbc3ac94ef01e98a3c0b5902/CMakeLists.txt#L249
>  would help, or you could just use more standard GNUInstallDirs module which 
> already handles that.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to