[CMake] building library with different compilers

Andreas Pakulat apaku at gmx.de
Thu Jan 17 04:12:13 EST 2008


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