AimplainLeo / osgocean

Automatically exported from code.google.com/p/osgocean
GNU Lesser General Public License v3.0
0 stars 0 forks source link

CMake build issues on MacOSX #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have encountered following CMake related build issues on MacOSX:

When running CMake, following error appear:
"CMake Error at src/osgOcean/CMakeLists.txt:136 (INSTALL):
  install TARGETS given no FRAMEWORK DESTINATION for shared library FRAMEWORK
  target "osgOcean"."
This error appears both for Xcode and "Unix makefiles" generator. It seems that 
you can't specify to build a framework while not specifying the FRAMEWORK 
DESTINATION.

The following patch fixes it (remove the FRAMEWORK property in 
src/osgOcean/CMakeLists.txt):
Replace: 
SET_TARGET_PROPERTIES(
  osgOcean
  PROPERTIES FRAMEWORK TRUE
  PUBLIC_HEADER "${LIB_HEADERS}"
)
with
SET_TARGET_PROPERTIES(
  osgOcean
  PROPERTIES
  PUBLIC_HEADER "${LIB_HEADERS}"
)

With this patch, you can only build dylib and no framework. But at least the 
dylib work. I don't use frameworks and I don't know enough about CMake to 
propose a patch that allows to build both dylib and frameworks on MacOSX.

There is an additional issue that only appears when building with XCode. The 
XCode project is generated successfully, but it doesn't build. Many errors like 
the following appear:
make: ../../CMakeScripts/ReRunCMake.make: No such file or directory
make: *** No rule to make target `../../CMakeScripts/ReRunCMake.make'.  Stop.

It compiles successfully, when I remove the line:
SET( CMAKE_USE_RELATIVE_PATHS true )

It seems that the XCode projects generated with CMake are not compatible with 
the relative paths. Would it be possible to remove this by default to allow 
XCode compile on the Mac?

Thanks,

Jean-Claude

Original issue reported on code.google.com by jcmon...@gmail.com on 25 Dec 2010 at 11:17

GoogleCodeExporter commented 9 years ago
Hi Jean-Claude,

Again thanks for pointing out the problems. 

I've surrounded the relative paths command with an IF(NOT APPLE) test so that 
it'll skip it for Mac OS/XCode projects. It's odd though, I haven't had anybody 
else complain about it and it has been built on a number of macs.

I've also removed the FRAMEWORK TRUE property as you suggested.

Cheers.

Kim.

Original comment by kcb...@googlemail.com on 2 Jan 2011 at 8:30

GoogleCodeExporter commented 9 years ago
Hi Kim,

Your patch works fine and it builds fine from a fresh checkout on my machine.
Would be interesting to know if others could compile on a mac without patches. 
I had this issue on all the macs I tried (2 machines).

Thanks,
Jean-Claude

Original comment by jcmon...@gmail.com on 3 Jan 2011 at 2:59