1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-15 15:11:12 +02:00

Transitive link dependencies via Audacity simplify module CMakeLists

This commit is contained in:
Paul Licameli
2021-02-15 14:44:49 -05:00
committed by Leland Lucius
parent 938bbeb4f9
commit ca7d96f20a
5 changed files with 9 additions and 32 deletions

View File

@@ -206,7 +206,6 @@ endmacro()
# Set up for defining a module target.
# All modules depend on the application.
# Pass a name and sources, and a list of other targets.
# Use the interface compile definitions and include directories of the
# other targets, and link to them.
@@ -223,36 +222,14 @@ function( audacity_module NAME SOURCES IMPORT_TARGETS
def_vars()
add_library( ${TARGET} MODULE )
# compute INCLUDES
unset( INCLUDES )
foreach( IMPORT ${IMPORT_TARGETS} )
unset( PROPS )
get_target_property( PROPS ${IMPORT} INTERFACE_INCLUDE_DIRECTORIES )
if (PROPS)
list( APPEND INCLUDES PUBLIC ${PROPS} )
endif()
endforeach()
list( APPEND INCLUDES PUBLIC ${TARGET_ROOT} )
# compute DEFINES
unset( DEFINES )
foreach( IMPORT ${IMPORT_TARGETS} )
unset( PROPS )
get_target_property( PROPS ${IMPORT} INTERFACE_COMPILE_DEFINITIONS )
if (PROPS)
list( APPEND DEFINES ${PROPS} )
endif()
endforeach()
list( APPEND DEFINES ${ADDITIONAL_DEFINES} )
set( LOPTS
PRIVATE
$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>
)
# compute LIBRARIES
set( LIBRARIES PRIVATE Audacity )
set( LIBRARIES PRIVATE )
foreach( IMPORT ${IMPORT_TARGETS} )
list( APPEND LIBRARIES "${IMPORT}" )
endforeach()
@@ -270,8 +247,8 @@ function( audacity_module NAME SOURCES IMPORT_TARGETS
organize_source( "${TARGET_ROOT}" "" "${SOURCES}" )
target_sources( ${TARGET} PRIVATE ${SOURCES} )
target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
target_compile_definitions( ${TARGET} PRIVATE ${ADDITIONAL_DEFINES} )
target_include_directories( ${TARGET} PUBLIC ${TARGET_ROOT} )
target_link_options( ${TARGET} PRIVATE ${LOPTS} )
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
endfunction()