[CMake] Re: Library linkage spewage under Makefiles (make -s)

James Bigler bigler at cs.utah.edu
Tue Dec 5 18:01:09 EST 2006


James Bigler wrote:
> James Bigler wrote:
>> In 2.2 when you specified SET(CMAKE_VERBOSE_MAKEFILE ON) and then did 
>> "make -s" you got some nice looking output of what you were building.
>>
>> Now with 2.4 it's all pretty and colored (nice!), but whenever I link 
>> a library I get what appears to be the contents of link.txt:
>>
>> Linking CXX shared library ../lib/libManta_Interface.so
>> /usr/bin/g++-4.0  -fPIC -O2  -shared -Wl,-soname,libManta_Interface.so 
>> -o ../lib/libManta_Interface.so 
>> "CMakeFiles/Manta_Interface.dir/AmbientLight.o"
>> ...
>> -L/tmp/bigler/manta/trunk/opt/lib -lManta_Core -lSCIRun_Core 
>> -Wl,-rpath,/tmp/bigler/manta/trunk/opt/lib
>>
>> Is there a way or option I could use to get this stuff to not output 
>> like it did before with 2.2?
> 
> I have some more information on this.
> 
> For regular object file builds you have a makefile rule that looks like 
> this:
> 
> Model/CMakeFiles/Manta_Model.dir/Backgrounds/ConstantBackground.o: 
> /tmp/bigler/manta/trunk/src/Model/Backgrounds/ConstantBackground.cc
>     $(CMAKE_COMMAND) -E cmake_progress_report 
> /tmp/bigler/manta/trunk/opt/CMakeFiles $(CMAKE_PROGRESS_3)
>     @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green 
> "Building CXX object 
> Model/CMakeFiles/Manta_Model.dir/Backgrounds/ConstantBackground.o"
>     /usr/bin/g++-4.0   $(CXX_FLAGS) -o 
> Model/CMakeFiles/Manta_Model.dir/Backgrounds/ConstantBackground.o -c 
> /tmp/bigler/manta/trunk/src/Model/Backgrounds/ConstantBackground.cc
> 
> 
> 
> 
> For the library you invoke the cmake program with the link.txt file:
> 
> lib/libManta_Model.so: Model/CMakeFiles/Manta_Model.dir/build.make
>     @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold 
> "Linking CXX shared library ../lib/libManta_Model.so"
>     cd /tmp/bigler/manta/trunk/opt/Model && $(CMAKE_COMMAND) -P 
> CMakeFiles/Manta_Model.dir/cmake_clean_target.cmake
>     cd /tmp/bigler/manta/trunk/opt/Model && $(CMAKE_COMMAND) -E 
> cmake_link_script CMakeFiles/Manta_Model.dir/link.txt --verbose=$(VERBOSE)
> 
> 
> 
> In 2.2.3 you invoke the linking directly:
> 
> lib/libManta_Model.so: Model/CMakeFiles/Manta_Model.dir/build.make
>     @echo "Linking CXX shared library ../lib/libManta_Model.so"
>     $(CMAKE_COMMAND) -E remove -f ../lib/libManta_Model.a 
> ../lib/libManta_Model.so
>     cd /home/sci/bigler/manta/trunk/opt-4.0.2/Model && /usr/bin/g++-4.0 
> -fPIC -Wl,-rpath,/usr/lib/gcc/i586-suse-linux/4.0.2 -shared 
> -Wl,-soname,libManta_Model.so -o ../lib/libManta_Model.so 
> $(Manta_Model_OBJECTS) $(Manta_Model_EXTERNAL_OBJECTS) 
> -L/home/sci/bigler/manta/trunk/opt-4.0.2/lib 
> -L/home/sci/bigler/pub/src/teem/muzzle-opt/bin -lManta_Image 
> -lManta_Interface -lManta_Core -lteem -lpng -lSCIRun_Core 
> -Wl,-rpath,/home/sci/bigler/manta/trunk/opt-4.0.2/lib:/home/sci/bigler/pub/src/teem/muzzle-opt/bin 
> 
> 
> 
> 
> The object file build calls the compiler directly and the library 
> linkage calls the cmake program with the $(VERBOSE) variable.  My guess 
> is that calling "make -s" doesn't override the VERBOSE variable.
> 
> I liked being able to turn on verbose makefiles and making them silent 
> by invocation.  This allowed me to rerun the make build with out the 
> silent option when it needed it without having to reconfigure and 
> rebuild the world.
> 
> Anyone have ideas of how to get around this?

I found one way around it, and perhaps this is the way it should have 
been done with respect to cmake created makefiles:

SET(CMAKE_VERBOSE_MAKEFILES OFF)

Then from the command line you can turn on chattiness like so:

make VERBOSE=1

I've tested this with 2.2.3 and 2.4.5.

If anyone else has any suggestions, they would be appreciated.

Thanks,
James


More information about the CMake mailing list