Original Post
Hey everybody, I'm an experienced C++ programmer who is relatively new to CMake and very new to developing on OSX (traditionally exclusively a Windows developer). I've got a project I'm working on written in C++ using SDL and OSG, and so far I've been developing exclusively in Windows, though the whole time I've been trying to keep my code theoretically cross-platform. I switched over to the CMake build system as a step towards building on multiple platforms, and now I'm trying to get my CMake scripts working for OSX (on my recently purchased MacBook) -- and I'm having some difficulty. I finally got everything compiling and the static linking apparently sorted out, but now when I run my application, I get some odd behavior. I seem to not ever see anything but a blue screen, and when I query for some things (like the viewport and lights and such) I get NULLs back when I'm expecting valid pointers. Note this is all code that works fine on Windows, and (as far as I can tell) my code isn't making any assumptions about building under Windows. As an experiment, I tried creating an xcode project from the osg application template. I then took the code generated from that, and wrote a cmake script that would create a new cmake-generated xcode project for this example osg code. Now, this code is Osfield-blessed, and very short, and makes no assumptions about platforms -- it even built, and ran correctly on this very Mac -- when configured with the right build settings. However, I cannot manage to find a way to come up with the correct magical cmake incantations to generate an xcode project that will correctly build a running executable that looks like the example is supposed to. Again I get blue screens, nothing but blue screens... I know that people have gotten cmake-based OSG projects building on the Mac, so I must just be missing something -- but I have no idea what, and what to search for. I noticed that the template-generated xcode project has a big "Link Binary With Libraries" section for the application target, and my cmake-generated xcode project does not...I tried modifying the cmake-generated xcode project to attempt to manually recreate this, but it doesn't seem to change my results at all. Other clues I have stumbled upon when browsing cmake scripts that supposedly build for the mac but are for projects more massive than mine (and as such the scripts aren't directly transferrable) but don't really understand involve the install() cmake command...Is this a required step, that might be used to somehow correctly associate dependent libraries with my app in a way that they might run correctly? Or is that just for preparing my app for distribution, something I don't need to think about yet until my app is running correctly on my own machine? As you can see, I am very confused and am grasping at straws at this point. The holy grail would be an extremely short but effective CMakeLists.txt file that will generate an xcode project that can successfully build a runnable and correctly working one-cpp-file OSG application -- from there I have faith that I can study its essentials and extract the wisdom I need to get my application running...but short of that, even just some clues for what to search for or what caveats I should be aware of will be immensely helpful. Has anyone out there tackled this problem before? Please help! {: ) Thank you for your time.