Page 1 of 1

Error in your CMakeLists.txt

Posted: Sun Apr 17, 2011 1:57 pm
by strook
You have an error in your CMakeLists.txt.

you link to libraries with the command add_library(...),
but with no effect.

to reduce compile time by putting long time not modified sources into a lib,
you must do this:

define your headers:
SET(MY_HEADERS /src/bla.h
/src/bla2.h)

define the sources:
SET(MY_SOURCES /src/bla.cpp
/src/bla2.cpp)

define a lib(Must Be static):

add_library(MY_LIB STATIC ${MY_HEADERS} ${MY_SOURCES} )

and include the headers and the lib into the project:

add_executable(my_app ${MY_HEADERS} ${OTHER_SOURCES} )
target_link_libraries(my_app MY_LIB)

note that the sources ${MY_SOURCES} are now excluded from your app. they are in the lib and don't need to be included in your app a second time.
note that MY_LIB is not a variable name like ${MY_LIB} in target_link_libraries()

Re: Error in your CMakeLists.txt

Posted: Mon Apr 18, 2011 11:49 pm
by klauss
Interesting...

I'll try to look into it when I have the time - which lately is scarce, but seems simple enough ;)

Re: Error in your CMakeLists.txt

Posted: Mon Apr 25, 2011 7:19 pm
by safemode
I'm guessing he is misreading the file.

nothing is compiled twice and linked twice and no libraries are compiled and never linked and no source is missing during compile. So either give some line numbers and examples or I would just attribute this to not correctly following the flow of the cmake file.

Re: Error in your CMakeLists.txt

Posted: Mon Apr 25, 2011 10:44 pm
by strook
hmmm i was shure you included them twice, cause you didn't include the headers.
on macosx it is needed to specify them in order that xcode can see them.

but yet, this isn't that importatant anyway, cause i'm going to move to eclipse on osx, cause i'll use distcc.

ok sorry. my fault. :oops:

Re: Error in your CMakeLists.txt

Posted: Tue Apr 26, 2011 4:08 pm
by safemode
Well if cmake isn't functioning correctly in mac I would be clueless. I dont use mac and everyone who has done a mac build and lived to tell the tale has made me ever more grateful that i never do any developing on macs. It's certainly possible things aren't working correctly on mac... I dont know and likely nobody else does cuz you can count the number of mac users that build VS on one hand on 3 fingers or less :)

Re: Error in your CMakeLists.txt

Posted: Wed Apr 27, 2011 6:29 pm
by strook
It isn't cmake, it is Xcode.
Cause in eclipse you see a copy of the filesystem beginning from the root folder of your project and eventually included subtrees.
In Xcode, you only see the files you specified in the CMakeLists.txt.

Compiling in Macosx is nearly the same as in Linux ( if you forget all the incompatibilities, special #ifdefs, etc.)
But it is hard enough to compile it without OpenGL and with ogre.
The vs GUI sources must be completely written anew.
And the other remaining vs sources...
I didn't compile them yet except those I already included.
I don't know wether I get the mission selector and vssetup running cause I didn't get gtk, gdk, and glibc running on Macosx.
Also I want get distcc running cause I got too many source files.
For this, I'll have to move to eclipse.
Also I'll have to check about cross compiling.
I have set up a minimal Linux system on Macosx with fink, but I must compile all the dependencies anew on Macosx to Linux libs to get it running with Macosx eclipse and distcc.
I have already set up a scaleable CMakeLists.txt that let's choose the libs to compile.
a minimal app is running.
You have seen it in pics.

I'm feeling a bit overwhelmed about the tasks to do.

I think I'll do a fallback and use the Mac just for compiling and make a bundle with all the libs included to run the vegaogre app as Linux app on Macosx, not as native app.

This way I could include a brunch of unmodified vs code and go over to developing the flight and including ogre into the app.
Also I'll use also OpenGL directly including it as a second render system as I intended it in the beginning.
It is advanced ogre programming, but doable.
This is the easiest way.

Else I would have to do too much modifications on old code.
El

Re: Error in your CMakeLists.txt

Posted: Fri Apr 29, 2011 11:58 pm
by klauss
Wait... why do you need to build without OpenGL?

OpenGL is pretty standard is it not?

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 12:09 am
by strook
We will have ogre instead of OpenGL.
You know ogre can use OpenGL.
But I don't need to use the sdl and other incompatible libs like glut, glew, then.

Also it's because two render systems won't work.

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 12:13 am
by klauss
IIRC, we still need SDL for joystick support.

So you should look into handing Ogre the SDL window, which I remember was possible (a bit awkward, but possible).

Done like that, you can actually mix Ogre and plain OpenGL - it's a tad tricky, but less tricky than rewriting everything IMO.

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 12:15 am
by strook
No I included ois :p

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 12:22 am
by klauss
strook wrote:No I included ois :p
Nice, I forgot about ois...

Still... wouldn't it make your life easier being able to mix Ogre and OpenGL?
At least it would make the transition possible in smaller steps.

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 12:31 am
by strook
It doesn't work. You would have to execute OpenGL and ogre draw functions after the other.
Ok, if using OpenGL for 2d and somehow switching to ogre and all is handled by another lib..... Maybe, but I'll better rewrite the gui source files(.cpp) to be handled by cegui.
It is a real ogre gui and has many possibilities (render-to-texture,btw, too).
Also, it is already set up and running.
All I have to do now is correct some errors. And rewrite some hanleable brunches of code.
I'm good experienced with vs and ogre now.
It won't last long to get a programming prototype of vs.

Re: Error in your CMakeLists.txt

Posted: Sat Apr 30, 2011 9:46 am
by strook
i'm using sdl now for the vs sound code.
installing the sdl dependencies was total uncritical :)