[Cmake] Re: Building static libraries

Bill Hoffman bill . hoffman at kitware . com
Wed, 11 Jun 2003 10:38:12 -0400


The best place for questions like this is the cmake mailing list,
so I have moved this discussion to the list.

Looks like the problem is that cmake is not able to figure out that
mpicc is really the gnu compiler.
In ~/CMake/Modules, there is a file called CMakeTestGNU.c, if you run
mpicc -E CMakeTestGNU.c what happens?

It should pre-process the file.   My guess is that your script does not
forward the -E option.



-Bill

At 10:19 AM 6/11/2003, you wrote:
>Hi,
>   I'm pretty new to CMake and I'm highly considering using CMake over Automake and Autoconf to manage our makefiles.  I think CMake seems to be a lot more intuitive, user-friendly, and more effcient, although the documentation leaves out a few things such as CMAKE_SYSTEM and CMAKE_COMPILER_IS_GNUXX (from the March 01 2002 post by Bill Hoffman).  
>I have two questions:
>
>1)  We use mpich, so I put mpiCC as the CXX compiler (essentially a script that eventually calls gcc).  However, under normal builds, CMake seems to add the options KPIC, which is unrecongnized.  I did not specify these options under normal builds or any of the other builds.
>
>ex:
>mpicc  -KPIC hello.o .........
>results in
>g++: unrecognized option `-KPIC'
>
>Is there a way I can get rid of these parameters from being passed in?
>
>2)  I am trying to also build a static library from a C++ file
>
>ADD_LIBRARY(zz STATIC hello/hello1.cc)
>
>but for some reason CMake runs mpiCC instead of the archiver ar
>
>mpiCC -xar -o libzt.a hello1.o
>
>It runs correctly (ar cr libzt.a  hello1.o) if I use gcc as the CXX compiler or if hello1 is a c file (hello1.c).  Is this a bug and how could I fix this?  Thank you very much.
>
>
>
>PS. please do not post this email adress on the web so spammers can find it.  Thanks!
>
>
>      Sincerely,
>      Zennard Sun