mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-12 23:19:12 +02:00
Transitive link dependencies via Audacity simplify module CMakeLists
This commit is contained in:
parent
938bbeb4f9
commit
ca7d96f20a
cmake-proxies/cmake-modules
modules
src
@ -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()
|
||||
|
@ -12,7 +12,7 @@ set( SOURCES
|
||||
ModNullCallback.cpp
|
||||
ModNullCallback.h
|
||||
)
|
||||
audacity_module( ${TARGET} "${SOURCES}" "wxWidgets"
|
||||
audacity_module( ${TARGET} "${SOURCES}" "Audacity"
|
||||
"${DEFINES}" "" )
|
||||
|
||||
set_target_properties( ${TARGET} PROPERTIES EXCLUDE_FROM_ALL YES )
|
||||
|
@ -12,7 +12,7 @@ set( DEFINES
|
||||
# versions of wxWidgets...even if the build is for Release.
|
||||
wxDEBUG_LEVEL=0
|
||||
)
|
||||
audacity_module( ${TARGET} "${SOURCES}" "wxWidgets;portaudio-v19;libnyquist"
|
||||
audacity_module( ${TARGET} "${SOURCES}" "Audacity"
|
||||
"${DEFINES}" "" )
|
||||
|
||||
set_target_properties( ${TARGET} PROPERTIES EXCLUDE_FROM_ALL YES )
|
||||
|
@ -13,5 +13,5 @@ set( DEFINES
|
||||
# debug versions of wxWidgets...even if the build is for Release.
|
||||
wxDEBUG_LEVEL=0
|
||||
)
|
||||
audacity_module( mod-script-pipe "${SOURCES}" "wxWidgets"
|
||||
audacity_module( mod-script-pipe "${SOURCES}" "Audacity"
|
||||
"${DEFINES}" "" )
|
||||
|
@ -1043,7 +1043,7 @@ list( APPEND LDFLAGS
|
||||
#
|
||||
#
|
||||
list( APPEND LIBRARIES
|
||||
PRIVATE
|
||||
PUBLIC
|
||||
${CMAKE_REQUIRED_LIBRARIES}
|
||||
wxWidgets
|
||||
expat
|
||||
@ -1306,7 +1306,7 @@ target_compile_definitions( ${TARGET} PRIVATE ${DEFINES} )
|
||||
target_compile_options( ${TARGET} PRIVATE ${OPTIONS} )
|
||||
target_include_directories( ${TARGET} PRIVATE ${INCLUDES} )
|
||||
target_link_options( ${TARGET} PRIVATE ${LDFLAGS} )
|
||||
target_link_libraries( ${TARGET} PRIVATE ${LIBRARIES} )
|
||||
target_link_libraries( ${TARGET} ${LIBRARIES} )
|
||||
|
||||
# If was have cmake 3.16 or higher, we can use precompiled headers, but
|
||||
# only use them if ccache is not available and the user hasn't disabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user