[CMake] building library with different compilers

Kalkuhl at boehme-weihs.de Kalkuhl at boehme-weihs.de
Thu Jan 17 08:21:16 EST 2008


Now I'm about to abandon using cmake.
I can't find a way to examine the different targets in a variable.
I made the different builddirs by defining subdirs:
ADD_LIBRARY(ora9i/libora ...
ADD_LIBRARY(ora10g/libora ...

and now? 
The problem is that I want to build both configurations simultaneously.

Regards,
Gabriel

On 17.01.08 09:15:46, Kalkuhl at boehme-weihs.de wrote:
> I want to build a database library for different oracle versions from one source.
> The pl/sql code should be compiled once by proC from Oracle 9 and by proC from Oracle 10.
> Therefore I defined different targets and tried to define the proC compiler with target properties
> but this doesn't work.
> The question now is if it is possible to define target properties in the way I did?

No and you don't need that, all you need is a way to find out or specify
wether you're building for oracle9 or oracle10. Then you can use
something like

if(ORCALE9_FOUND)
  ADD_LIBRARY(libora9i)
  FIND_PROGRAM(PROC_BIN ...)
else(ORCALE9_FOUND)
  ADD_LIBRARY(libora10g)
  FIND_PROGRAM(PROC_BIN ..)
endif(ORACLE9_FOUND)

ADD_CUSTOM_COMMAND(...)

And then you "just" need two separate builddirs, one for the oracle9 and
the other for the oracle10 build. Building in oracle9 builddir should
set ORACLE9_FOUND to TRUE, and it should be set to FALSE when building
oracle10 stuff.

Andreas

-- 
Chicken Little was right.



More information about the CMake mailing list