Symbolic links CMake

前端 未结 6 442
抹茶落季
抹茶落季 2020-12-17 10:34

I want to rename certain executables in CMakeLists.txt but also want symbolic links from the older names to new files for backward compatibility. How can this b

6条回答
  •  爱一瞬间的悲伤
    2020-12-17 11:36

    I've struggled with this a few different ways with the above responses in order to install '.so.#' files that refer to other '.so.#.#' files. I've had success by not introducing a link to the file, but by installing the '.so.#.#' file as the '.so.#' file.

    I.e. instead of

    install(
        FILES
            .../libmpi.so.12.0
        DESTINATION lib
    )
    
    install(CODE 
        "EXECUTE_PROCESS( ${CMAKE_COMMAND} -E create_symlink lib/libmpi.so.12.0 lib/libmpi.so.12)")
    

    Which didn't quite work for me even. I have instead had success by doing this.

    install(FILES 
            .../libmpi.so.12.0
        RENAME libmpi.so.12
        DESTINATION lib
    )
    

    Not 'exactly' the same, but sufficient. Don't defeat the problem, solve the problem.

提交回复
热议问题