I've started using fixup_bundle(). One of the things that occurs to me is that much of the information that needs to go into fixup_bundle() arguments (executables and library directories) can be gleaned from arguments to add_executable() and target_link_libraries().

It might be nice to extend these two standard functions to create variables that could be used with fixup_bundle. I could see writing macros or functions to wrap this up for my projects, but I think it might belong in the "standard" versions of these.
Perhaps this already exists and I have simply not seen it?

I'd like to get to a world where we could do something like:

# tell CMake to remember the executable names and libraries for each
set(CMAKE_BUILD_FIXUP_ARGS ON)

add_executable(execName ... BUNDLEME)
target_link_libraries(execName lib1 lib2 ...)
install(TARGETS execName ... )

add_executable(progName ... BUNDLEME)
target_link_libraries(progName lib1 lib18 ...)
install(TARGETS execName ...)

fixup_bundle(${CMAKE_INSTALL_TARGETS}
            ""
            ${CMAKE_execName_LIBPLACES} ${CMAKE_progName_LIBPLACES})

I'm speculating that it is target_link_libraries that I would extend with the capability to generate the lists of library locations (some code and conventions required for DLL platforms). I could see some people wanting to avoid bundling executables they do not want to install, so a flag for add_executable to indicate whether to bundle seems like it would work.

In any case, this would allow you to do a fixup_bundle() as a POST_BUILD stage so that things could be run from the build directory. This is nice for testing prior to doing an install.

Thoughts?
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to