Loading a library from a script

My problem here is that I am using CMake and ROOT_GENERATE_DICTIONARY. This macro builds a rootmapfile, but it doesn’t work correctly.

First, it needs to be manually installed, more of an annoyance than anything else:

#Install the ROOT 6 PCM and rootmap files.
if (${ROOT_VERSION} VERSION_GREATER "6.0")                                                             
   install(                                                                                            
      FILES
         ${CMAKE_CURRENT_BINARY_DIR}/libFooDict_rdict.pcm                                      
         ${CMAKE_CURRENT_BINARY_DIR}/libFooDict.rootmap                                        
      DESTINATION lib/)
endif (${ROOT_VERSION} VERSION_GREATER "6.0")

Secondly the rootmap file is incorrectly named for the library libFooDict.rootmap and top of the rootmap file reads:

[ libFooDict.so ]

This is incorrect as I am on a Mac and the extension should by .dylib and in addition it should not have the Dict. At some point I will make a small example and open a new thread with issues related to ROOT_GENERATE_DICTIONARY (I have a couple additional issues as well).