[CMake] CC, CXX, and FC environment variable regression in 2.8.1-rc4

Bill Hoffman bill.hoffman at kitware.com
Sun Mar 14 15:28:56 EDT 2010


Alan W. Irwin wrote:
> I often build with
> 
> export CC='gcc -g -fvisibility=hidden
> export CXX='g++ -g -fvisibility=hidden'
> and
> export FC='gfortran -g -fvisibility=hidden'
> 
> but recently this has quit working because CMake fails to add the 
> necessary -fPIC flag to shared library builds.
> 
> Sorry I don't know the last CMake version where this worked, but I am 
> pretty
> sure I have used this sort of build successfully for earlier versions of
> 2.8.x, and definitely for cmake-2.6.4.
> 
> If I specify the flags another way, e.g.,
> 
> cmake -DCMAKE_C_FLAGS:STRING="-g -fvisibility=hidden" \
> -DCMAKE_CXX_FLAGS:STRING="-g -fvisibility=hidden" \
> -DCMAKE_Fortran_FLAGS:STRING="-g -fvisibility=hidden" \
> ...
> 
> the necessary -fPIC flag for shared libraries is added in properly. 
> However,
> I would like the more convenient (set and forget) environment variable
> approach to continue to work as previously.
> 
Perhaps adding the flags causes the compiler to be mis-identified 
somehow.   Can you run with the gcc -g -fvisibility=hidden, and without 
on a very simple C only project.  Then send me the binary trees from 
both.  I am suspecting there will be some sort of error in the compiler 
id code.

-Bill

-- 
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518 881-4905 (Direct)
518 371-3971 x105
Fax (518) 371-4573


More information about the CMake mailing list