[Cmake] problem with too eager SET_SOURCE_FILES_PROPERTIES

Ken Martin ken.martin at kitware.com
Fri Dec 6 15:27:20 EST 2002


Hello Ian,

At least poart of your problem may be a bug in the
SET_SOURCE_FILE_PROPERTIES such that once a flag was added to one file
it also gets added to all subsequent files. This has been fixed in the
CVS version of CMake and is on the table to be fixed in CMake 1.4.7
should we release a CMake 1.4.7. The fix is pretty easy if you want to
give it a short on CMake 1.4.6 basically from the cvs diffs of
cmLocalUnixMakfileGenerator.cxx 

6,7c6,7
<   Date:      $Date: 2002/11/22 21:59:21 $
<   Version:   $Revision: 1.42 $
---
>   Date:      $Date: 2002/12/02 15:33:35 $
>   Version:   $Revision: 1.43 $
2373a2374,2375
>         std::string compileFlags = exportsDef;
>         compileFlags += " ";
2375a2378
>
2378,2379c2381
<             exportsDef += (*source)->GetProperty("COMPILE_FLAGS");
<             exportsDef += " ";
---
>             compileFlags += (*source)->GetProperty("COMPILE_FLAGS");
2384c2386
<                                             exportsDef.c_str(),
---
>                                             compileFlags.c_str(),

the same change needs to be made to cmUnixMakefileGenerator.cxx in CMake
1.4.6 

Ken

> -----Original Message-----
> From: cmake-admin at public.kitware.com [mailto:cmake-
> admin at public.kitware.com] On Behalf Of Ian Scott
> Sent: Friday, December 06, 2002 3:21 PM
> To: Cmake at Public. Kitware. Com (E-mail)
> Cc: Vxl-maintainers (E-mail)
> Subject: [Cmake] problem with too eager SET_SOURCE_FILES_PROPERTIES
> 
> VXL has several (27 to be precise) cases where we need a
> 
> IF(CMAKE_COMPILER_IS_GNUCXX)
>   SET_SOURCE_FILES_PROPERTIES(wibble.cxx COMPILE_FLAGS -O0)
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
> 
> to avoid internal compiler errors.
> 
> I have noticed two problems with this.
> 
> The -O2 is being added to lots of build commands which were never
> specified,
> e.g.
> from vxl/core/vnl/Makefile
> #---------------------------------------------------------
> # Build vnl_math.o  From /work/vxl/src/core/vnl/vnl_math.cxx
> #
> 
> vnl_math.o: /work/vxl/src/core/vnl/vnl_math.cxx
>         echo "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS
-O0
> $(CMAKE_SHLIB_C
> FLAGS) $(INCLUDE_FLAGS) -c /work/vxl/src/core/vnl/vnl_math.cxx -o
> vnl_math.o"
>         $(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS -O0
> $(CMAKE_SHLIB_CFLAGS)
>  $(INCLUDE_FLAGS) -c /work/vxl/src/core/vnl/vnl_math.cxx -o vnl_math.o
> 
> #---------------------------------------------------------
> # Build vnl_copy.o  From /work/vxl/src/core/vnl/vnl_copy.cxx
> #
> 
> vnl_copy.o: /work/vxl/src/core/vnl/vnl_copy.cxx
>         echo "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS
-O0
> $(CMAKE_SHLIB_C
> FLAGS) $(INCLUDE_FLAGS) -c /work/vxl/src/core/vnl/vnl_copy.cxx -o
> vnl_copy.o"
>         $(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS -O0
> $(CMAKE_SHLIB_CFLAGS)
>  $(INCLUDE_FLAGS) -c /work/vxl/src/core/vnl/vnl_copy.cxx -o vnl_copy.o
> 
> vnl_math.cxx was specified to have -O0, but vnl_copy.cxx was not.
> 
> Not all files have -O0 added to them. It appears that when one file
has -
> O0
> added legitimately, every other compile line in the Makefile also has
-O0
> added. Further legitimate -O0s add extra -O0s to the command line.
> 
> Templates/vnl_vector_fixed+float.4-.o:
> /work/vxl/src/core/vnl/Templates/vnl_vector_fixed
> +float.4-.cxx
>         echo "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS
-O0
> $(CMAKE_SHLIB_C
> FLAGS) $(INCLUDE_FLAGS) -c
> /work/vxl/src/core/vnl/Templates/vnl_vector_fixed+float.4-.cx
> x -o Templates/vnl_vector_fixed+float.4-.o"
>         $(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS -O0
> $(CMAKE_SHLIB_CFLAGS)
>  $(INCLUDE_FLAGS) -c
> /work/vxl/src/core/vnl/Templates/vnl_vector_fixed+float.4-.cxx -o T
> emplates/vnl_vector_fixed+float.4-.o
> 
> #---------------------------------------------------------
> # Build vnl_matrix+long-.o  From
> /work/vxl/src/core/vnl/Templates/vnl_matrix+long-.cxx
> #
> 
> vnl_matrix+long-.o:
/work/vxl/src/core/vnl/Templates/vnl_matrix+long-.cxx
>         echo "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS
-O0 -
> O0
> $(CMAKE_SHL
> IB_CFLAGS) $(INCLUDE_FLAGS) -c
> /work/vxl/src/core/vnl/Templates/vnl_matrix+long-.cxx -o
> vnl_matrix+long-.o"
>         $(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) -Dvnl_EXPORTS -O0 -O0
> $(CMAKE_SHLIB_CFL
> AGS) $(INCLUDE_FLAGS) -c
> /work/vxl/src/core/vnl/Templates/vnl_matrix+long-.cxx -o vnl_ma
> trix+long-.o
> 
> Since ITK also uses VNL - they may also be running at much less than
full
> power.
> 
> The second problem is that I have also tested this with Intel's icc.
None
> of
> them should have a -O0 added, since the guard is checking for
> CMAKE_COMPILER_IS_GNUCXX. So I guess that CMAKE_COMPILER_IS_GNUCXX is
> reporting true for icc by mistake. I have tried setting the internal
> variable in the cache to no effect.
> 
> I would appreciate an urgent fix. If someone could point me in the
right
> direction I might even be able to fix it myself.
> 
> I've found this problem in both cmake 1.4.4 and cmake 1.4.6
> 
> Any ideas?
> 
> Ian.
> 
> 
> _______________________________________________
> Cmake mailing list
> Cmake at public.kitware.com
> http://public.kitware.com/mailman/listinfo/cmake





More information about the CMake mailing list