View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010588CMakeCMakepublic2010-04-21 11:202016-06-10 14:31
Reportertisi 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0010588: Customizable <OBJECTS> tag-variable
DescriptionThe tag-variable <OBJECS> can be used for rule variables, which contains all object files for linking or generating a library. Some Linkers/Libarians need flags before each object files, e.g.

libarian -a object1 -a object2 -a object3 etc. (e.g. Softune compiler)

or some mor exotic construct with brackets (e.g. Keil compiler)

At the moment it is only possible to use such compilers with shell wrapper scripts - but that is not very portable, because on the dependency of the shell. (e.g. windows has batch-interpreter, unix has bash, csh and so on)

It would be nice to have some customization feature for the <OBJECTS> tag, like
for example:

SET(CMAKE_LINK_OBJECTS_PREFIX "-o(")
SET(CMAKE_LINK_OBJECTS_CLUE ",")
SET(CMAKE_LINK_OBJECTS_FILE_FLAG "-f")
SET(CMAKE_LINK_OBJECTS_POSTFIX ")")

which will produce:

link -o(-f object1,-f object2, -f object3)

(and the same for the ar)

---

Or another approach for this problem is customizaion by regular expressions (this could be used by all tag variables, and could be less confusing than additional variables):

<OBJECTS:REGEX(/ /,)>

produces object1,object2,object3 instead of object1 object2 object3

This approach can also reduce the amount of necessary cmake variables e.g. like CMAKE_LINK_LIBRARY_FILE_FLAG:

instead of

SET(CMAKE_LINK_LIBRARY_FILE_FLAG "-l")

someone could use something like

<LINK_LIBRARIES:REGEX(/ /-l ):REGEX(/^/-l ))>

For this approach more than one regex should be possible and should be handled from left to right.




TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0020348)
Brad King (manager)
2010-04-22 09:39

The CMake language does not have first-class functions, lambdas, or other functional programming capabilities. I think any syntax that tries to process strings at generation-time with an expression like <OBJECTS:REGEX(...)> will be too limited to be practical for anything but a specific case like this. Instead of trying to implement such capabilities I think it is easier to handle this specific case directly.

Instead of customizing <OBJECTS> we could provide an <OBJECTS_CUSTOM> tag that constructs the list of objects using variables like

  set(CMAKE_LINK_OBJECTS_CUSTOM_PREFIX "-o(")
  set(CMAKE_LINK_OBJECTS_CUSTOM_SEPARATOR ", ")
  set(CMAKE_LINK_OBJECTS_CUSTOM_FILE_FLAG "-f ")
  set(CMAKE_LINK_OBJECTS_CUSTOM_SUFFIX ")")

or

  set(CMAKE_LINK_OBJECTS_CUSTOM_PREFIX "")
  set(CMAKE_LINK_OBJECTS_CUSTOM_SEPARATOR " ")
  set(CMAKE_LINK_OBJECTS_CUSTOM_FILE_FLAG "-a ")
  set(CMAKE_LINK_OBJECTS_CUSTOM_SUFFIX "")

The C++ code implementing this would construct the <OBJECTS_CUSTOM> value by using the components specified by the variables without any other intervening spaces.

If you want to try implementing this, take a look at cmMakefile*TargetGenerator.cxx and cmLocalGenerator.* source files for cmLocalGenerator::RuleVariables and cmLocalGenerator::ExpandRuleVariable. The implementation has been hacked up as necessary over the years and could certainly be cleaner than it is, but it does what it needs to do so far.
(0030486)
Brad King (manager)
2012-08-13 10:36

Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041686)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-04-21 11:20 tisi New Issue
2010-04-21 13:37 Bill Hoffman Status new => assigned
2010-04-21 13:37 Bill Hoffman Assigned To => Brad King
2010-04-22 09:39 Brad King Note Added: 0020348
2012-08-13 10:36 Brad King Status assigned => backlog
2012-08-13 10:36 Brad King Note Added: 0030486
2016-06-10 14:27 Kitware Robot Note Added: 0041686
2016-06-10 14:27 Kitware Robot Status backlog => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team