[CMake] kdevelop3 generator broke

William A. Hoffman billlist at nycap.rr.com
Fri Mar 11 08:39:26 EST 2005


>
>So here come some first impressions for the new Makefile generator, most 
>important first: 
> 
>1) some internal generated variables have been renamed: 
>${target_NAME}_SRC_OBJS was renamed to ${target_NAME}_OBJECTS 
>Was this necessary ? I know this is internal, but it broke my build. Now 
>I have to check which one of both exists. I have a custom rule to link my 
>objects together (for an embedded target): 
> 
>ADD_CUSTOM_COMMAND( 
>   TARGET ${_exe_NAME}  
>   PRE_LINK  
>   COMMAND ${CMAKE_C_COMPILER}  
>      ARGS -o foo $\(foo_OBJECTS\) -nostdlib  -nostartfiles  
>     -Lecos/install/lib -Ttarget.ld -mcpu=xscale 
>   ) 
> 
>and the main target being  
>ADD_LIBRARY(foolib static ${foo_SRCS}) 
> 
>So everytime this lib is built my actual target is also linked. Is there 
>a way to change the "normal" link command so that it looks like my custom 
>command, so that I don't have to build this dummy static lib ? 
> 

You can set the variables:
CMAKE_(LANG)_CREATE_SHARED_LIBRARY
CMAKE_(LANG)_CREATE_STATIC_LIBRARY
CMAKE_(LANG)_LINK_EXECUTABLE

Where (LANG) can be C CXX, etc.

See CMakeCInformation.cmake defaults for C. 

# now define the following rule variables

# CMAKE_C_CREATE_SHARED_LIBRARY
# CMAKE_C_CREATE_SHARED_MODULE
# CMAKE_C_CREATE_STATIC_LIBRARY
# CMAKE_C_COMPILE_OBJECT
# CMAKE_C_LINK_EXECUTABLE

# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# <LINK_FLAGS>

# C compiler information
# <CMAKE_C_COMPILER>  
# <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_C_FLAGS>
# <CMAKE_C_LINK_FLAGS>

# Static library tools
# <CMAKE_AR> 
# <CMAKE_RANLIB>


Setting those variables would be a better way to go.

>2) "Scanning dependancies" for each file is quite slow. Do you plan to 
>optimize it ? 
> 

We compared it to the older one, and thought they were about the same.
If you are just changing a few source files, it should actually be faster,
as it will only have to do the depends for the files that actually changed
and not the whole directory as was done before.

>3) After editing one of my included cmake-files cmake again scanned 
>dependancies for all objects files and built them *all* again, although I 
>changed only my custom rule to link them all together in the end. 
> 
This may be a bug.  The idea is that if a flag changes all the objects should
be rebuilt.  However, this may be too aggressive, and there was a variable added
to turn this off, perhaps that should be the default.   

>4) cmake now generates a subdir where it puts stuff and the Makefile is 
>split into many small files. Which are the advantages of this approach ? 
>The many included files in the Makefile don't make it easier to read. 
> 

This allows for targets to have the same source file compiled with different flags.


>Bye 
>Alex 
> 
>P.S. yesterday I tried the new XCode generator the first time and it 
>worked. Very cool :-) 
> 

Thanks!

-Bill 



More information about the CMake mailing list