Skip to content

Commit

Permalink
Install compiled libraries only to 'lib' (#195)
Browse files Browse the repository at this point in the history
* Install compiled libraries only to 'lib'

The current behavior results in duplicate libraries installed to both
the Python module in libdir and also into the global lib directory for
the prefix.

The former seems unnecessary, so we should install the libraries only to
lib.

Signed-off-by: Scott K Logan <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
cottsay and clalancette authored Nov 9, 2023
1 parent a1dc3d9 commit 058080f
Showing 1 changed file with 7 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,6 @@ set_property(
${_generated_extension_files} ${_generated_py_files} ${_generated_c_files}
PROPERTY GENERATED 1)

macro(set_properties _build_type)
set_target_properties(${_target_name} PROPERTIES
COMPILE_OPTIONS "${_extension_compile_flags}"
PREFIX ""
LIBRARY_OUTPUT_DIRECTORY${_build_type} ${_output_path}
RUNTIME_OUTPUT_DIRECTORY${_build_type} ${_output_path}
OUTPUT_NAME "${PROJECT_NAME}_s__${_typesupport_impl}${PythonExtra_EXTENSION_SUFFIX}"
SUFFIX "${PythonExtra_EXTENSION_EXTENSION}")
endmacro()

macro(set_lib_properties _build_type)
set_target_properties(${_target_name_lib} PROPERTIES
COMPILE_OPTIONS "${_extension_compile_flags}"
LIBRARY_OUTPUT_DIRECTORY${_build_type} ${_output_path}
RUNTIME_OUTPUT_DIRECTORY${_build_type} ${_output_path})
endmacro()

# Export target so downstream interface packages can link to it
set(rosidl_generator_py_suffix "__rosidl_generator_py")

Expand Down Expand Up @@ -236,13 +219,11 @@ foreach(_typesupport_impl ${_typesupport_impls})
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(_extension_compile_flags -Wall -Wextra)
endif()
set_properties("")
if(WIN32)
set_properties("_DEBUG")
set_properties("_MINSIZEREL")
set_properties("_RELEASE")
set_properties("_RELWITHDEBINFO")
endif()
set_target_properties(${_target_name} PROPERTIES
COMPILE_OPTIONS "${_extension_compile_flags}"
PREFIX ""
OUTPUT_NAME "${PROJECT_NAME}_s__${_typesupport_impl}${PythonExtra_EXTENSION_SUFFIX}"
SUFFIX "${PythonExtra_EXTENSION_EXTENSION}")
target_link_libraries(
${_target_name}
${_target_name_lib}
Expand Down Expand Up @@ -291,13 +272,8 @@ foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
target_link_libraries(${_target_name_lib} ${${_pkg_name}_TARGETS${rosidl_generator_py_suffix}})
endforeach()

set_lib_properties("")
if(WIN32)
set_lib_properties("_DEBUG")
set_lib_properties("_MINSIZEREL")
set_lib_properties("_RELEASE")
set_lib_properties("_RELWITHDEBINFO")
endif()
set_target_properties(${_target_name_lib} PROPERTIES
COMPILE_OPTIONS "${_extension_compile_flags}")
if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
install(TARGETS ${_target_name_lib}
EXPORT export_${_target_name_lib}
Expand Down

0 comments on commit 058080f

Please sign in to comment.