View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012987CMakeCMakepublic2012-02-21 09:592012-04-19 15:51
ReporterEmmanuel Blot 
Assigned ToAlex Neundorf 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSOS XOS Version10.7.3
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0012987: Multiple redefinitions with cross compilation for eCos
DescriptionUsing the following sequence to enable eCos cross-compilation (from any host):

INCLUDE (CMakeForceCompiler)
SET (CMAKE_SYSTEM_NAME eCos)
CMAKE_FORCE_C_COMPILER (arm-eabi-gcc GNU)
CMAKE_FORCE_CXX_COMPILER (arm-eabi-gcc GNU)

whenever the PROJECT() command is invoked,
the file Modules/Platform/eCos.cmake is parsed and "executed" several times (3 times on my current configuration).

The net result is that line 45
ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
is executed 3 times, and the definitions are appended to each other.

Running CMake with the VERBOSE flag enables shows that the command line is filled in with the same definitions:
arm-eabi-gcc -D__ECOS__=1 -D__ECOS=1 -D__ECOS__=1 -D__ECOS=1 -D__ECOS__=1 -D__ECOS=1 ....
TagsNo tags attached.
Attached Files? file icon eCos.cmake [^] (2,973 bytes) 2012-03-20 17:16

 Relationships

  Notes
(0028681)
Eric NOULARD (developer)
2012-02-21 11:15

From algorithm described here:
Source/cmGlobalGenerator.cxx
lines 225-265
right before void cmGlobalGenerator::EnableLanguage

I would says that the multiple load is "normal"

1 for each enables languages (C and C++ may be)
1 other for ???

That said eCos.cmake is the only Platform/*.cmake file which is using
ADD_DEFINITION
$ cd Modules/Platform
$ grep ADD_DEFINITION *
eCos.cmake:ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)

does ADD_DEFINITIONS belongs to a Platform file?

If this is the case
may be that call should be protected against multiple inclusion
with some guard VARIABLE like

if (NOT ECOS_CMAKE_INCLUDED)
   ADD_DEFINITIONS(-D__ECOS__=1 -D__ECOS=1)
   set(ECOS_CMAKE_INCLUDED 1)
endif(NOT ECOS_CMAKE_INCLUDED)

would this work in your case?
(0028683)
Emmanuel Blot (reporter)
2012-02-21 12:29

> does ADD_DEFINITIONS belongs to a Platform file?
I cant' tell :-)

> would this work in your case?
Indeed, it works fine, I just tested it.
(0028684)
Emmanuel Blot (reporter)
2012-02-21 12:29

> 1 other for ???
ASM-ATT I would say.
(0028945)
Alex Neundorf (developer)
2012-03-20 17:17

Can you please give the attached eCos.cmake a try ?
It has an include-guard at the top and should also work.

Please let me know here whether it works for you or not.

Alex
(0028973)
Alex Neundorf (developer)
2012-03-26 15:48

Did you already find the time to give the attached file a try ?
(0028977)
Emmanuel Blot (reporter)
2012-03-27 05:09

Sorry, I forgot. You are right to ping me back, I'll give a try today.
(0028978)
Emmanuel Blot (reporter)
2012-03-27 05:21

Hi Alex,

Yes it works, the __ECOS__ and __ECOS flags are now only defined once, and I saw no regression while building a typical eCos project.

Thanks,
Emmanuel.
(0028992)
Alex Neundorf (developer)
2012-03-28 15:41

Merged into master, and fix confirmed by reporter.

 Issue History
Date Modified Username Field Change
2012-02-21 09:59 Emmanuel Blot New Issue
2012-02-21 11:15 Eric NOULARD Note Added: 0028681
2012-02-21 12:19 Alex Neundorf Assigned To => Alex Neundorf
2012-02-21 12:19 Alex Neundorf Status new => assigned
2012-02-21 12:29 Emmanuel Blot Note Added: 0028683
2012-02-21 12:29 Emmanuel Blot Note Added: 0028684
2012-03-20 17:16 Alex Neundorf File Added: eCos.cmake
2012-03-20 17:17 Alex Neundorf Note Added: 0028945
2012-03-26 15:48 Alex Neundorf Note Added: 0028973
2012-03-27 05:09 Emmanuel Blot Note Added: 0028977
2012-03-27 05:21 Emmanuel Blot Note Added: 0028978
2012-03-28 15:41 Alex Neundorf Note Added: 0028992
2012-03-28 15:41 Alex Neundorf Status assigned => closed
2012-03-28 15:41 Alex Neundorf Resolution open => fixed
2012-04-19 15:51 David Cole Fixed in Version => CMake 2.8.8
2012-04-19 15:51 David Cole Target Version => CMake 2.8.8


Copyright © 2000 - 2018 MantisBT Team