diff --git a/cmake-proxies/cmake-modules/CopyLibs.cmake b/cmake-proxies/cmake-modules/CopyLibs.cmake index b11b8bc3e..ddb5d9ae6 100644 --- a/cmake-proxies/cmake-modules/CopyLibs.cmake +++ b/cmake-proxies/cmake-modules/CopyLibs.cmake @@ -8,7 +8,6 @@ # message( "==================================================================" ) message( "Copying wxWidgets libraries:" ) -message( "${SRC} ${DST}" ) message( "==================================================================" ) # list command no longer ignores empty elements. @@ -62,7 +61,7 @@ function( gather_libs src ) foreach( line ${output} ) if( line MATCHES "^.*libwx.*\\.dylib " ) string( REGEX REPLACE "dylib .*" "dylib" line "${line}" ) - if( NOT line STREQUAL "${src}" ) + if( NOT line STREQUAL "${src}" AND NOT line MATCHES "@executable" ) set( lib ${line} ) list( APPEND libs ${lib} ) @@ -75,7 +74,9 @@ function( gather_libs src ) endif() endforeach() elseif( CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" ) - execute( output ldd ${src} ) + execute( output sh -c "LD_LIBRARY_PATH='${WXWIN}' ldd ${src}" ) + + get_filename_component( libname "${src}" NAME ) foreach( line ${output} ) if( line MATCHES ".*libwx.*" ) diff --git a/cmake-proxies/wxWidgets/CMakeLists.txt b/cmake-proxies/wxWidgets/CMakeLists.txt index 83d590d38..fc2344394 100644 --- a/cmake-proxies/wxWidgets/CMakeLists.txt +++ b/cmake-proxies/wxWidgets/CMakeLists.txt @@ -61,6 +61,14 @@ if( wxWidgets_FOUND ) > ) + set( WXWIN $ENV{WXWIN} CACHE INTERNAL "" ) + if( WXWIN ) + string( APPEND WXWIN "/lib" ) + else() + set( WXWIN "${wxWidgets_LIBRARY_DIRS}" ) + endif() + set( WXWIN "${WXWIN}" CACHE INTERNAL "" ) + set( toolkit "${wxWidgets_LIBRARIES}" ) else() message( STATUS "Using local '${name}' library" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index daaa42dd6..0808ea7de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1264,6 +1264,7 @@ else() COMMAND ${CMAKE_COMMAND} -D SRC="${_EXEDIR}/audacity" -D DST="${_DEST}/${_PKGLIB}" + -D WXWIN="${WXWIN}" -P ${CMAKE_MODULE_PATH}/CopyLibs.cmake POST_BUILD )