Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use boost library names instead of Boost_LIBRARIES var for .pc file generation #187

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Conversation

planthaber
Copy link

This PR only affects the non-catkin case.

In recent versions of FindBoost.cmake (e.g. on Ubuntu 20.04),
Boost_LIBRARIES contains the cmake targets (Boost::thread,
Boost::system) instead of library names.

pkg-config --libs class_loader retruns
[...]-lclass_loader Boost::thread;Boost::system;[...]

Those cannot be linked downstream when cmake is not used or
find_package(Boost) is not executed again to actually find/define the
targets.

…eneration

In recent versions of FindBoost.cmake (e.g. on Ubuntu 20.04),
Boost_LIBRARIES contains the cmake targets (Boost::thread,
Boost::system) instead of library names.

pkg-config --libs class_loader retruns
[...]-lclass_loader Boost::thread\;Boost::system\;[...]

Those cannot be linked downstream when cmake is not used or
find_package(Boost) is not executed again to actually find/define the
targets.

Signed-off-by: Steffen Planthaber <[email protected]>
@@ -63,7 +63,7 @@ endif()
if(NOT catkin_FOUND)
set(TARGET_NAME ${PROJECT_NAME})
set(PKGCONFIG_LIBS
${Boost_LIBRARIES}
boost_thread boost_system
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@planthaber hmm, I'd rather lookup libraries from targets instead, using get_target_property().

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that this will work, because it will not provide libraries from recursive dependencies.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there's a chance, using INTERFACE_LINK_LIBRARIES, but I'll let you guys do the digging.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INTERFACE_LINK_LIBRARIES and LINK_LIBRARIES also contains the targets:

Boost::threadBoost::system/opt/workspace/install/lib/libbase-logging.so/usr/lib/x86_64-linux-gnu/libPocoFoundation.sodl

There are (currently) no other upstream dependencies, but yes, it would be cleaner to to use the libs found rather than hard-coding them (in case of upstream changes).

Nevertheless, I didn't find a decent target property containing the actual libs (used https://stackoverflow.com/a/34292622).

class_loader AUTOGEN_ORIGIN_DEPENDS = ON
class_loader AUTOMOC_COMPILER_PREDEFINES = ON
class_loader AUTOMOC_MACRO_NAMES = Q_OBJECT;Q_GADGET;Q_NAMESPACE
class_loader AUTOMOC_PATH_PREFIX = ON
class_loader BINARY_DIR = /opt/workspace/tools/class_loader/build
class_loader BINARY_DIR = /opt/workspace/tools/class_loader/build
class_loader BUILD_WITH_INSTALL_RPATH = OFF
class_loader IMPORTED = FALSE
class_loader IMPORTED_GLOBAL = FALSE
class_loader INCLUDE_DIRECTORIES = /opt/workspace/install/include;/opt/workspace/tools/class_loader/include;/opt/workspace/install/include;/usr/include;/usr/include
class_loader INCLUDE_DIRECTORIES = /opt/workspace/install/include;/opt/workspace/tools/class_loader/include;/opt/workspace/install/include;/usr/include;/usr/include
class_loader INCLUDE_DIRECTORIES = /opt/workspace/install/include;/opt/workspace/tools/class_loader/include;/opt/workspace/install/include;/usr/include;/usr/include
class_loader INSTALL_RPATH = 
class_loader INSTALL_RPATH_USE_LINK_PATH = OFF
class_loader INTERFACE_LINK_LIBRARIES = Boost::thread;Boost::system;/opt/workspace/install/lib/libbase-logging.so;/usr/lib/x86_64-linux-gnu/libPocoFoundation.so;dl
class_loader LINK_LIBRARIES = Boost::thread;Boost::system;/opt/workspace/install/lib/libbase-logging.so;/usr/lib/x86_64-linux-gnu/libPocoFoundation.so;dl
class_loader NAME = class_loader
class_loader POSITION_INDEPENDENT_CODE = True
class_loader SKIP_BUILD_RPATH = OFF
class_loader SOURCES = src/class_loader.cpp;src/class_loader_core.cpp;src/meta_object.cpp;src/multi_library_class_loader.cpp;include/class_loader/class_loader.h;include/class_loader/class_loader_core.h;include/class_loader/class_loader_exceptions.h;include/class_loader/class_loader_register_macro.h;include/class_loader/console_bridge_compatibility.h;include/class_loader/meta_object.h;include/class_loader/multi_library_class_loader.h
class_loader SOURCE_DIR = /opt/workspace/tools/class_loader
class_loader SOURCE_DIR = /opt/workspace/tools/class_loader
class_loader TYPE = SHARED_LIBRARY
class_loader TYPE = SHARED_LIBRARY
class_loader UNITY_BUILD_BATCH_SIZE = 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants