1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

addlib supplies absolute path to add_subdirectory...

... not assuming that it is invoked from cmake-proxies/CMakeLists.txt

This will allow modules to use lib-src libraries, and even for a module to be
the sole user of one of them.

So addlib lines may be moved out of cmake-proxies/CMakeLists.txt, when no
longer needed to build the reduced executable without the modules.
This commit is contained in:
Paul Licameli 2020-09-23 21:49:13 -04:00 committed by Leland Lucius
parent dd1ce8dd63
commit ec3d2424a5

View File

@ -389,6 +389,9 @@ endmacro()
# packages A list of packages required for this target in pkg-config # packages A list of packages required for this target in pkg-config
# format. # format.
function( addlib dir name symbol required check ) function( addlib dir name symbol required check )
set( subdir "${CMAKE_SOURCE_DIR}/cmake-proxies/${dir}" )
set( bindir "${CMAKE_BINARY_DIR}/cmake-proxies/${dir}" )
# Extract the list of packages from the function args # Extract the list of packages from the function args
list( SUBLIST ARGV 5 -1 packages ) list( SUBLIST ARGV 5 -1 packages )
@ -402,7 +405,7 @@ function( addlib dir name symbol required check )
# If we're not checking for system or local here, then let the # If we're not checking for system or local here, then let the
# target config handle the rest. # target config handle the rest.
if( NOT check ) if( NOT check )
add_subdirectory( ${dir} EXCLUDE_FROM_ALL ) add_subdirectory( ${subdir} ${bindir} EXCLUDE_FROM_ALL )
return() return()
endif() endif()
@ -469,10 +472,10 @@ function( addlib dir name symbol required check )
message( STATUS "Using '${name}' local library" ) message( STATUS "Using '${name}' local library" )
# Pull in the target config # Pull in the target config
add_subdirectory( ${dir} EXCLUDE_FROM_ALL ) add_subdirectory( ${subdir} ${bindir} EXCLUDE_FROM_ALL )
# Get the list of targets defined by that config # Get the list of targets defined by that config
get_property( targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS ) get_property( targets DIRECTORY "${subdir}" PROPERTY BUILDSYSTEM_TARGETS )
# Set the folder (for the IDEs) for each one # Set the folder (for the IDEs) for each one
foreach( target ${targets} ) foreach( target ${targets} )