Please keep replies on the list so others may join or benefit from the 
conversation.

You will need to add the "macosx_bundle" flag to your add_executable() command. 
This tells CMake to generate the instructions to create a proper OS X 
application bundle.

Next you will need to explore adding a "add_custom_command" and copy the 
libOpenMeshCore.2.0.dylib library into the application bundle after the build 
process. The rest of the libraries are referenced by their absolute path so for 
just running from the build directory you should be fine.

Next up is deployment. If you are going to deploy this application to other 
computers you will want to look into "BundleUtilities.cmake" which will help 
you create a standalone OS X application bundle (and bundles for other 
operating systems).

Also you typically have something like:

# Set some Win32 Specific Settings
IF(WIN32)
 SET(GUI_TYPE WIN32)
ELSEif(APPLE)
 SET(GUI_TYPE MACOSX_BUNDLE)
ENDIF(WIN32)

Then you have "add_executable( MeshVisualization ${GUI_TYPE} .....)" which will 
give you the proper Visual Studio setup on Windows.

The alternate thing you can do is to use "install_name_tool" on the actual 
"libOpenMeshCore.2.0.dylib" file to change from a path that begins with 
"@exectuable_path" to an absolute path that leads to the library.

___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jack...@bluequartz.net 
BlueQuartz Software               Dayton, Ohio

On Aug 31, 2011, at 10:06 AM, Yifei Li wrote:

> Mike,
> 
> I don't have macosx_ bundle in add_executable().
> 
> My app also depends on other libraries besides openmesh such as Qt, and 
> "otool -L MeshVisualization" shows that :
> /usr/local/Trolltech/Qt-4.8.0/lib/QtOpenGL.framework/Versions/4/QtOpenGL 
> (compatibility version 4.8.0, current version 4.8.0)
>       /usr/local/Trolltech/Qt-4.8.0/lib/QtGui.framework/Versions/4/QtGui 
> (compatibility version 4.8.0, current version 4.8.0)
>       /usr/local/Trolltech/Qt-4.8.0/lib/QtCore.framework/Versions/4/QtCore 
> (compatibility version 4.8.0, current version 4.8.0)
>       @executable_path/../Libraries/libOpenMeshCore.2.0.dylib (compatibility 
> version 2.0.0, current version 2.0.0)
>       /opt/local/lib/libGLEW.1.5.1.dylib (compatibility version 0.0.0, 
> current version 0.0.0)
>       /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility 
> version 1.0.0, current version 1.0.0)
>       /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL 
> (compatibility version 1.0.0, current version 1.0.0)
>       /usr/local/qwt/lib/libqwt.5.dylib (compatibility version 5.2.0, current 
> version 5.2.1)
>       
> /Users/yifli/Documents/MeshVisualization/build/Build/lib/Debug/../MeshVisLib.dylib
>  (compatibility version 0.0.0, current version 0.0.0)
>       /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current 
> version 52.0.0)
>       /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
> version 159.0.0)
> 
> Yifei
> 
> 
> On Aug 31, 2011, at 9:52 AM, Michael Jackson wrote:
> 
>> You need to copy the library into the .app bundle at 
>> MeshVisualization.app/Contents/Libraries/.
>> 
>> Your "add_executable()" command should have the "MACOSX_BUNDLE" set in. See 
>> the help listing for the add executable.
>> ___________________________________________________________
>> Mike Jackson                      www.bluequartz.net
>> Principal Software Engineer       mike.jack...@bluequartz.net 
>> BlueQuartz Software               Dayton, Ohio
>> 
>> On Aug 31, 2011, at 9:04 AM, Yifei Li wrote:
>> 
>>> Hi all,
>>> 
>>> My app MeshVisualization uses a library called OpenMesh. I had a runtime 
>>> error when running the app: 
>>> dyld: Library not loaded: 
>>> @executable_path/../Libraries/libOpenMeshCore.2.0.dylib
>>> Referenced from: 
>>> /Users/yifli/Documents/MeshVisualization/build/Build/bin/MeshVisualization
>>> Reason: image not found
>>> 
>>> 
>>> My FindOpenMesh.cmake does find the library and defines 
>>> OPENMESH_LIBRARY:  OpenMeshCore
>>> OPENMESH_LIBRARY_DIR: /usr/local/lib/OpenMesh
>>> 
>>> However, I noticed from compiling details:
>>> ld: warning: directory not found for option 
>>> '-L/usr/local/lib/OpenMesh/Debug'
>>> 
>>> So how should I solve the runtime problem? Thanks
>>> 
>>> 
>>> Yifei
>>> 
>>> _______________________________________________
>>> Powered by www.kitware.com
>>> 
>>> Visit other Kitware open-source projects at 
>>> http://www.kitware.com/opensource/opensource.html
>>> 
>>> Please keep messages on-topic and check the CMake FAQ at: 
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: 
>> http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to