List the library file paths in the target_link_libraries command
13:00 01 Dec 2025

So, I have this in a CMakeLists.txt:

cmake_minimum_required(VERSION 3.19)
project(MyHello LANGUAGES CXX)

find_package(deal.II 9.4.2 CONFIG REQUIRED)
find_package(Boost REQUIRED)
find_package(TBB CONFIG REQUIRED)

add_executable(dealII_test dealII_test.cpp)

target_link_libraries(dealII_test
                      PUBLIC TBB::tbb
                      PUBLIC TBB::tbbmalloc
                      PUBLIC TBB::tbbmalloc_proxy
                      PRIVATE Boost::boost
                      PRIVATE deal_II
)

I'm getting the following error in Ninja:

ninja: error: '/lib', needed by 'dealII_test.exe', missing and no known rule to make it

If I comment out the PRIVATE deal_II part, I get more mundane errors of Deal.II header files not being found. Hence, I'm sure there is something wrong with the deall_II part in the taget_link_libraries() call. I suppose the /lib in the error should be a complete path in wherever it was defined.

Trouble is I can't locate the origin of the misdefinition that causes the error. So, I'd like to know how to debug or print the contents of whatever is inside deal_II part.

I tried the most-voted answer of Displaying a target's list of linked libraries in cmake but I only get what I already know by just reading the CMake script. I'd like some kind of full list of DLL/SO/LIB files being linked against the executable not the high-level dependency names already listed in CMakeLists.txt.

I'm building with Conan, so I'm better off trying to debug deal_II contents via the recipe and/or the CMakeLists.txt files involved.

c++ cmake ninja conan-2