I have some debug info in CMake to check if I have added no needed info compiling a project. This piece of code works propertly:
# Include DIRECTORIES
GET_PROPERTY(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
FOREACH(dir ${dirs})
MESSAGE(STATUS " * Include directory: '${dir}'")
ENDFOREACH()
But when I try to check all libraries linked in current project, I get an empty variable:
# Linking against
GET_PROPERTY(libtargets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_LIBRARIES)
MESSAGE("Libs: ${libtargets}")
FOREACH(libtarget ${libtargets})
MESSAGE(STATUS " * Target Link library: '${libtarget}'")
ENDFOREACH()
Checking CMake documentation 3.0 it seems ok, but I don't know what values are available to read. I print the info AFTER make ADD_LIBRARY
/ADD_EXECUTABLE
Is the LINK_LIBRARIES
an incorrect value to GET_PROPERTY
? How could I get that information?
Directories don't have the LINK_LIBRARIES
property according to this page:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-properties.7.html?highlight=properties%20targets#properties-on-directories
Also I think target_link_libraries
would have effect only on the target on which it was called, not on the directory. Try using get_target_property
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With