MantisBT - CMake
View Issue Details
0009822CMakeCMakepublic2009-11-02 10:522014-06-02 08:37
Mathieu Malaterre 
Stephen Kelly 
normalminorhave not tried
closedfixed 
 
CMake 3.0 
0009822: Please expose: cmGlobalGenerator::GetExportSet at cmake level
It would be very nice if cmGlobalGenerator::GetExportSet was expose at cmake level. This would allow easily exporting a build tree, just as easily as exporting an install tree.

typicaly project:
add_executable(generator generator.c)
add_library(mylib mylib.c)


Compare code for install tree:
...
install(TARGETS generator DESTINATION lib/myproj/generators EXPORT myproj-targets)
install(TARGETS mylib DESTINATION lib/myproj EXPORT myproj-targets)
# in a single line to export all target attached to myproj-targets
install(EXPORT myproj-targets DESTINATION lib/myproj)
...
# myproj-targets.cmake, properly contains all targets attached to myproj-targets

while for a build-tree:

# need to initialize an empty file:
file(WRITE ${COSMO_BINARY_DIR}/CoSMoExports.cmake "")
# manually book-keep target that have been attached to myproj-targets
if(build_generator)
  export(TARGETS generator APPEND FILE ${bla}/CoSMoExports.cmake)
endif()
if(build_mylib)
  export(TARGETS mylib APPEND FILE ${bla}/CoSMoExports.cmake)
endif()
# There is no way we are not missing a target listed in myproj-targets


Thanks,
No tags attached.
Issue History
2009-11-02 10:52Mathieu MalaterreNew Issue
2009-11-02 11:12Bill HoffmanStatusnew => assigned
2009-11-02 11:12Bill HoffmanAssigned To => Brad King
2009-11-02 12:10Brad KingNote Added: 0018315
2009-11-02 12:17Mathieu MalaterreNote Added: 0018316
2009-11-02 12:34Mathieu MalaterreNote Added: 0018317
2012-08-13 10:37Brad KingStatusassigned => backlog
2012-08-13 10:37Brad KingNote Added: 0030531
2013-12-23 11:12Stephen KellyAssigned ToBrad King => Stephen Kelly
2013-12-23 11:12Stephen KellyStatusbacklog => assigned
2014-01-02 15:09Stephen KellyNote Added: 0034898
2014-01-02 15:09Stephen KellyStatusassigned => resolved
2014-01-02 15:09Stephen KellyFixed in Version => CMake 3.0
2014-01-02 15:09Stephen KellyResolutionopen => fixed
2014-06-02 08:37Robert MaynardNote Added: 0036069
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0018315)
Brad King   
2009-11-02 12:10   
Perhaps

  install(TARGETS generator ... EXPORT myproj-targets)
  install(TARGETS mylib ... EXPORT myproj-targets)
  install(EXPORT myproj-targets DESTINATION lib/myproj)

  # Export targets included in myproj-targets installation:
  export(EXPORT myproj-targets FILE ${bla}/CoSMoExports.cmake)

?
(0018316)
Mathieu Malaterre   
2009-11-02 12:17   
That would be truly fantastic. In fact I initially thought this was implemented when I saw 'export(PACKAGE)'...

If you get a chance at implementing export(EXPORT), I'd like to volunteer for testing it.

Thanks,
(0018317)
Mathieu Malaterre   
2009-11-02 12:34   
For later reference, here is what I used to catch any missing SHARED lib:

if(EXISTS
    ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${COSMO_INSTALL_CMAKE_DIR}/CoSMoTargets.cmake
    )
  file(READ
    ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${COSMO_INSTALL_CMAKE_DIR}/CoSMoTargets.cmake
    ENT
    )
  STRING(REGEX REPLACE "\r?\n" ";" ENT "${ENT}")
  foreach(line ${ENT})
    string(REGEX MATCH "ADD_LIBRARY\\(.*SHARED IMPORTED\\)" m ${line})
    if( m )
      string(REGEX REPLACE "ADD_LIBRARY\\((.*) SHARED IMPORTED\\)" "\\1" out ${m})
      list(FIND COSMO_LIBRARIES ${out} out2)
      if( out2 EQUAL -1)
        message(FATAL_ERROR "Found the library /${out}/, while the complete list is: ${COSMO_LIBRARIES}")
      endif()
    endif()
  endforeach(line)
endif()
(0030531)
Brad King   
2012-08-13 10:37   
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.
(0034898)
Stephen Kelly   
2014-01-02 15:09   
Done:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cbe7e8fa [^]
(0036069)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.