From ec3d2424a550de7c58357c44391b5a0a8b2378a5 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 23 Sep 2020 21:49:13 -0400 Subject: [PATCH] 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. --- cmake-proxies/cmake-modules/AudacityFunctions.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake-proxies/cmake-modules/AudacityFunctions.cmake b/cmake-proxies/cmake-modules/AudacityFunctions.cmake index 8d49885af..98a427456 100644 --- a/cmake-proxies/cmake-modules/AudacityFunctions.cmake +++ b/cmake-proxies/cmake-modules/AudacityFunctions.cmake @@ -389,6 +389,9 @@ endmacro() # packages A list of packages required for this target in pkg-config # format. 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 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 # target config handle the rest. if( NOT check ) - add_subdirectory( ${dir} EXCLUDE_FROM_ALL ) + add_subdirectory( ${subdir} ${bindir} EXCLUDE_FROM_ALL ) return() endif() @@ -469,10 +472,10 @@ function( addlib dir name symbol required check ) message( STATUS "Using '${name}' local library" ) # 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_property( targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS ) + get_property( targets DIRECTORY "${subdir}" PROPERTY BUILDSYSTEM_TARGETS ) # Set the folder (for the IDEs) for each one foreach( target ${targets} )