2008/5/1 Dick Hollenbeck <dick@...>:
I doubt the linkers can choose individual bitmaps from the library this
way. I believe a typical linker can only pull in an entire *.o file
from the library, not a partial. So this is not what I had in mind.
What I had in mind was to put each bitmap into a library separately.
By separately, I mean as an individual *.o file tucked into the library,
one for each bitmap.
Gotcha. In theory that's easy enough, however I've hit a bug in cmake.
I've tested with a release candidate of cmake 2.6 and it works
properly there, but we should probably wait at least until it's out
before pre-reqing it. In case I'm busier at the time I'll get it out
on the mailing list...
bitmaps/CMakeLists.txt:
-------------------------------
add_definitions(-DXPMMAIN)
FILE(GLOB BITMAP_SRCS *.xpm)
SET_SOURCE_FILES_PROPERTIES(${BITMAP_SRCS} PROPERTIES LANGUAGE CXX
COMPILE_FLAGS "-x c++")
add_library(bitmaps ${BITMAP_SRCS})
SET_TARGET_PROPERTIES(bitmaps PROPERTIES LINKER_LANGUAGE CXX)
-------------------------------
Then add bitmaps.a to the appropriate targets.
The only dodgy bit is the "-x c++" which is needed so the compiler
needs to know what to do with .xpm files. There would need to be an
equivalent option for all the other compilers we want to support.
I'll tidy up the bitmaps in the mean time (one dir, all in the header,
no individual includes, etc.)