file GET_RUNTIME_DEPENDENCIES - cannot access variables

Hello. I am checking out this new feature but it seems like I cannot print out the dependencies. The part of my cmake script is

                RESOLVED_DEPENDENCIES_VAR resolved_deps
                UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
                EXECUTABLES boost_timer_example just_a_thread
        MESSAGE(\"Contents of variables: ${resolved_deps} ${unresolved_deps}\")"

Calling cmake .. && make install results in such log:

[100%] Built target boost_timer_example
Install the project...
-- Install configuration: ""
Contents of variables:

Variables are not printed out. I have noticed that just after calling cmake .. alone (without make), cmake_install.cmake is created with contents like that:

                RESOLVED_DEPENDENCIES_VAR resolved_deps
                UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
                EXECUTABLES boost_timer_example just_a_thread
        MESSAGE("Contents of variables:  ")

Which clearly indicates the variables are substituted for nothing at configuration time.
What am I doing wrong?

Hi @tgq,

You need to escape the $ signs in the install command. Right now, the ${resolved_deps} and ${unresolved_deps} will be expanded at configure time, and hence be empty.


MESSAGE(\"Contents of variables: \${resolved_deps} \${unresolved_deps}\")
Works, thanks you :smiley:

The paths seem to be wrong tho. This is the output of RESOLVED_DEPENDENCIES_VAR:

Resolved deps just_a_thread: /lib/aarch64-linux-gnu/;/lib/x86_64-linux-gnu/;/lib/aarch64-linux-gnu/;/lib/aarch64-linux-gnu/;/lib/aarch64-linux-gnu/;/lib/aarch64-linux-gnu/;/lib/x86_64-linux-gnu/

Calling ldd to find out dependencies:

tgq@qq:~/qqprojectboost/build$ ldd just_a_thread (0x00007ffc371f6000) => /lib/x86_64-linux-gnu/ (0x00007fc282b5e000) => /lib/x86_64-linux-gnu/ (0x00007fc282985000) => /lib/x86_64-linux-gnu/ (0x00007fc28296b000) => /lib/x86_64-linux-gnu/ (0x00007fc2827ab000)
        /lib64/ (0x00007fc282b8c000) => /lib/x86_64-linux-gnu/ (0x00007fc282666000)

I have a crosscompiler installed (aarch64-linux-gnu) somewhere on the system but i never use it. Why did CMake fill the resolved deps with the crosscompiler’s libs? Isn’t that some bug? My arch is x86_64.

@kyle.edwards Seems we’re getting system paths from the wrong place somehow?

I found 15 minutes to reproduce the issue and ran it on ubuntu and debian machines. On ubuntu every crosscompiler pointed me to aarch64 directory, on debian to x86_64. In every case the paths should point to the one associated with the compiler.
Here’s the example I’m talking about:

I just tried it on Ubuntu 16.04 and was not able to reproduce - it got the correct paths. I’m going to try on 18.04 next.

Could not reproduce with 18.04 or the debian:latest Docker image. Please open an issue with a Dockerfile (or some other script) with the exact environment needed to reproduce this.