<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello everyone,<div>I try to build a small Qt application (helloGUI) with a shared library (hello).</div><div>Here is my application and library tree:</div><div>├── CMakeLists.txt<br>├── gui<br>│   ├── CMakeLists.txt<br>│   ├── bundle.cmake<br>│   ├── include<br>│   │   └── MainWindow.hpp<br>│   ├── src<br>│   │   ├── MainWindow.cpp<br>│   │   └── main.cpp<br>│   └── ui<br>│       └── mainwindow.ui<br>└── lib<br>    ├── CMakeLists.txt<br>    ├── Hello.cpp<br>    └── Hello.h</div><div><br></div><div>My root CMakeLists.txt add the two sub directory: lib then gui.</div><div>The lib CMakeLists.txt build a shared library (.dylib) and installed it inside ${CMAKE_INSTALL_PREFIX}/helloGUI.app/Contents/Libraries.</div><div>The gui CMakeLists.txt build my Qt bundle (helloGUI.app) and installed it inside ${CMAKE_INSTALL_PREFIX} then launch the script bundle.cmake.</div><div>bundle.cmake contains:</div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(66, 109, 147);"><span style="color: #011993">include</span><span style="color: #000000">(</span>BundleUtilities<span style="color: #000000">)</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(57, 51, 255);"><span style="color: #000000">fixup_bundle(</span>"${CMAKE_INSTALL_PREFIX}/helloGUI.app"<span style="color: #000000"> </span>"${CMAKE_INSTALL_PREFIX}/helloGUI.app/Contents/Libraries/libHello.dylib"<span style="color: #000000"> </span>"lib"<span style="color: #000000">)</span></div></div><div><br></div><div>If I don’t install it, my application works just fine. But after installation, I have some errors:</div><div><br></div><div>Install the project...<br>-- Install configuration: ""<br>-- Installing: /MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Libraries/libHello.dylib<br>-- Installing: /MYPATH/TestQtCMake/build/install/./helloGUI.app<br>-- Installing: /MYPATH/TestQtCMake/build/install/./helloGUI.app/Contents<br>-- Installing: /MYPATH/TestQtCMake/build/install/./helloGUI.app/Contents/Info.plist<br>-- Installing: /MYPATH/TestQtCMake/build/install/./helloGUI.app/Contents/MacOS<br>-- Installing: /MYPATH/TestQtCMake/build/install/./helloGUI.app/Contents/MacOS/helloGUI<br>-- fixup_bundle<br>--   app='/MYPATH/TestQtCMake/build/install/helloGUI.app'<br>--   libs='/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Libraries/libHello.dylib'<br>--   dirs='lib'<br>-- fixup_bundle: preparing...<br>-- fixup_bundle: copying...<br>-- 1/10: *NOT* copying '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Libraries/libHello.dylib'<br>-- 2/10: *NOT* copying '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/MacOS/helloGUI'<br>-- 3/10: copying '/Users/rleguay/Qt5.2.1/5.2.1/clang_64/lib/QtCore.framework/Versions/5/QtCore'<br>-- 4/10: copying '/Users/rleguay/Qt5.2.1/5.2.1/clang_64/lib/QtGui.framework/Versions/5/QtGui'<br>-- 5/10: copying '/Users/rleguay/Qt5.2.1/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets'<br>-- fixup_bundle: fixing...<br>-- 6/10: fixing up '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Libraries/libHello.dylib'<br>-- 7/10: fixing up '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/MacOS/helloGUI'<br>-- 8/10: fixing up '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore'<br>-- 9/10: fixing up '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui'<br>-- 10/10: fixing up '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets'<br>-- fixup_bundle: cleaning up...<br>-- fixup_bundle: verifying...<br>-- ===========================================================================<br>-- Analyzing app='/MYPATH/TestQtCMake/build/install/helloGUI.app'<br>-- bundle='/MYPATH/TestQtCMake/build/install/helloGUI.app'<br>-- executable='/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/MacOS/helloGUI'<br>-- valid='1'<br>-- executable file 1: /MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/MacOS/helloGUI<br>-- warning: embedded item does not exist '/MYPATH/TestQtCMake/build/install/helloGUI.app/Contents/MacOS/libHello.dylib'<br>-- <br>warning: cannot resolve item '@executable_path/../MacOS/libHello.dylib'<br><br>  possible problems:<br>    need more directories?<br>    need to use InstallRequiredSystemLibraries?<br>    run in install tree instead of build tree?<br><br>warning: target '@executable_path/../MacOS/libHello.dylib' is not absolute...<br>warning: target '@executable_path/../MacOS/libHello.dylib' does not exist...<br>error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: @executable_path/../MacOS/libHello.dylib (No such file or directory)<br>error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: @executable_path/../MacOS/libHello.dylib (No such file or directory)<br>-- verified='1'<br>-- info='Verified 1 executable files in '/MYPATH/TestQtCMake/build/install/helloGUI.app''<br>-- <br>-- verified='1'<br>-- info=''<br>-- <br>-- fixup_bundle: done</div><div><br></div><div>I see that the script search libHello.dylib inside Contents/MacOS but I don’t understand why. </div><div>Can we set this path please?</div><div><br></div><div>Thank you.</div><div><br></div><div>Best regards,</div><div>Romain</div></body></html>