[CMake] Installing files: modification dates, directory trees

William A. Hoffman billlist at nycap.rr.com
Sun Mar 20 21:12:39 EST 2005


I think this is fixed in cvs.  CVS cmake re-runs ranlib after the install on OSX.
Try cvs and if it works for you, no need to create a bug.

-Bill


At 10:40 AM 3/20/2005, Brad King wrote:
>Jaroslav Snajdr wrote:
>>I have two issues with using CMake in my project:
>>1. On Mac OS X, it is necessary to run ranlib on a static library (lib*.a). The ranlib process inserts a timestamp into the *.a file, and if the file is later copied to another location, the modification time of the file is changed and later linker complains that the table of contents of the archive is out of date, because of timestamp mismatch. The solution is either to not change the modification time when installing the library (cp -p), or rerun ranlib after the copy. The cp -p solution is obviously better. CMake doesn't do either thing though, so the INSTALL_TARGETS result is broken for static libraries. Any remedy to that?
>
>Please submit this as a bug report here:
>
>http://www.cmake.org/Bug
>
>I think the proper solution is to let the modification time get changed and then run ranlib.  The reason is that if any other build trees on the system list the staic library as a dependency then the modification time needs to change to get them to relink.
>
>As a work around until this is fixed you can create your own post-install rule for the library to run ranlib:
>
>IF(APPLE)
>  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mylib_postinst.cmake.in
>                 ${CMAKE_CURRENT_BINARY_DIR}/mylib_postinst.cmake
>                 @ONLY IMMEDIATE)
>  SET_TARGET_PROPERTIES(mylib PROPERTIES POST_INSTALL_SCRIPT
>    ${CMAKE_CURRENT_BINARY_DIR}/mylib_postinst.cmake)
>ENDIF(APPLE)
>
>Then create mylib_postinst.cmake with a command like this:
>
>EXEC_PROGRAM(ranlib ARGS "@CMAKE_INSTALL_PREFIX@/lib/libmylib.a")
>
>>2. I have a directory tree of auxiliary files in my project I need to copy to the destination, i.e. copy the whole directory tree to the destination without any change. However, the INSTALL_FILES command can only install files in a single directory. Is there any way to solve this problem without creating a CMakeLists.txt file in each and every directory and changing the SUBDIRS line every time I add or remove a directory from the tree?
>
>Installing an entire directory sounds useful.  Please submit this as a feature request in the bug tracker mentioned above.  I can't think of a simple work around that would be more maintainable than the SUBDIRS/INSTALL_FILES option right now.
>
>-Brad
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list