[CMake] Two questions

Jorge Rodriguez jrodriguez at xvt.com
Mon Aug 14 15:21:50 EDT 2006


1) Is there any way to build a target library as static and shared, with 
the same name? ADD_LIBRARY only takes a static OR a shared library, and 
not both. I would like to do something like this:

ADD_LIBRARY(foo STATIC SHARED ${Sources})

such that libfoo.so and libfoo.a are both built. Currently the only 
other way I can do this is to build

ADD_LIBRARY(foo SHARED ${Sources})
ADD_LIBRARY(foos STATIC ${Sources})

and then "cp libfoos.a libfoo.a" after this is done. However, this 
doubles the build time for this library.

2) Is there anything like:

IF(WIN64)
    MESSAGE("Win 64!")
ENDIF(WIN64)

I notice that on a 64 bit build machine with a 64 bit compiler, this 
does not print the message, but IF(WIN32) works fine. (Which is good, 
because I have alot of IF(WIN32)'s that I would like to work on win64 as 
well.) The only way I can tell if we are running a 64 bit build is by 
running 'cl' (the compiler) and parsing the output for 'for x64' instead 
of 'for 80x86'. Is there a better way to do this?

-- 
Jorge Rodriguez
XVT Software Development
Email: jrodriguez at xvt.com
Phone: (919) 854-1800 x222




More information about the CMake mailing list