[Cmake] different compiler in subdirs ?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jun 15 06:38:24 EDT 2004


> > From: "Alexander Neundorf" 
> > Subject: [Cmake] different compiler in subdirs ? 
> >  
> > Hi,  
> > 
> > I'd like to use cmake for cross-compiling.  
> > What I would like to do is to have a big source 
> > tree, everything "managed"  
> > by cmake, where in some directories stuff for the 
... 
  
> Hi, I'm hoping somebody else will address this 
> question too because I also have almost the exact same 
> situation (need to invoke a vxworks compiler). 
>  
> But until I can figure out a better solution, I've 
> been trying two different things for the embedded 
> stuff (the non-embedded stuff can use CMake in a 
> normal manner).  
>  
> First, I tried building my own rules using 
> ADD_CUSTOM_TARGET, where I invoke the embedded 
> compiler directly with the flags I need. But one of 
> the problems I've been having though is a "make clean" 
> doesn't necessarily clean up the files. I've found a 
> little hack where if you make the target name the path 
> and name of the file generated, it seems to clean it 
> up. However, I don't know if there are any bad issues 
> I should be worried about. The other problem I have is 
> that our source tree is large and complicated enough 
> that I don't know all the dependencies, and using 
> ADD_CUSTOM_TARGET requires you to list all the 
> dependencies if you expect things to rebuild when, say 
> a header file is changed. 
 
Currently I'm doing  
 
SET(CMAKE_CXX_COMPILER "arm-elf-c++") 
SET(CMAKE_COMPILER_IS_GNUCXX 1) 
SET(CMAKE_C_COMPILER "arm-elf-gcc") 
SET(CMAKE_AR "arm-elf-ar") 
SET(CMAKE_RANLIB "arm-elf-ranlib") 
 
in the CMakeLists.txt in the subdir where I want to compile for the 
target. 
 
Together with SET_SOURCE_FILE_PROPERTIES(${sources} PROPERTIES 
OBJECT_DEPENDS <my_embedded_target_lib>}, ADD_CUSTOM_COMMAND(OUTPUT 
<my_embedded_target_lib> ...) and SET_DIRECTORY_PROPERTIES( 
ADDITIONAL_MAKE_CLEAN_FILES <my_embdedded_target_lib)  it works quite well 
for me. 
 
Bye 
Alex 
 

-- 
+++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl



More information about the Cmake mailing list