When we restarted orxonox with CMake, we put such a CMakeLists.txt (CMLs) in every folder. That forced us to create a library for every folder, so we changed things.
Half a year or so ago I was looking for a solution with CMLs in every folder, but just one library and didn't come up with something.
In the meantime, a lot of source files have been written into src/orxonox/CMLs and it's not very clear anymore.
Is there any way to have a CMLs in every folder after all? Maybe with a CMake macro, I don't know.
I'm asking now because we've caught a PPS student with a large knowledge about CMake, right Adi?
CMakeLists.txt
Moderator: PPS-Leaders
CMakeLists.txt
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.
A webcomic of romance, sarcasm, math, and language.
Issue resolved: CMake does have a lot of catches, but finally with the Cache I managed to meet my wishes.
Consider you want to include files according to the following structure:
orxonox
objects
worldentities
Your CMLs in orxonox folder folder should look like this:
In orxonox/objects, the CMLs looks a little bit different:
And for the third CMLs in orxonox/object/worldentities:
Note that variables in subdirectories are in a completely separate set. You cannot override any variable in the parent directory and vice versa.
I have applied that concept to all our own folders in the trunk.
Consider you want to include files according to the following structure:
orxonox
objects
worldentities
Your CMLs in orxonox folder folder should look like this:
Code: Select all
SET( SRC_FILES FooBar.cc FooBar2.cc )
ADD_SOURCE_DIRECTORY(SRC_FILES objects)
Code: Select all
SET( SRC_FILES BarFoo.cc BarFoo2.cc )
ADD_SOURCE_DIRECTORY(SRC_FILES worldentities)
# Do this after ADD_SOURCE_DIRECTORY !
ADD_SOURCE_FILES(SRC_FILES)
Code: Select all
SET( SRC_FILES AsdfBlah.cc AsdfBlah2.cc )
ADD_SOURCE_FILES(SRC_FILES)
Note that variables in subdirectories are in a completely separate set. You cannot override any variable in the parent directory and vice versa.
I have applied that concept to all our own folders in the trunk.
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.
A webcomic of romance, sarcasm, math, and language.
Who is online
Users browsing this forum: No registered users and 2 guests