Path to target output file

后端 未结 3 2053
离开以前
离开以前 2020-12-05 13:07

I have a .so library target created by add_library, and need to pass an absolute path to this library to an external script. Now I have ${LIBRARY_OUTPUT_P

3条回答
  •  渐次进展
    2020-12-05 13:26

    To expand on the answer by @bgooddr, here is a CMake function to get the location of a target:

    function(get_fancy_lib_location)
        set(options)
        set(multiValueArgs LIB)
        set(oneValueArgs LOCATION)
        cmake_parse_arguments(get_fancy_lib_location "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
        message (STATUS "fancy_lib  == ${get_fancy_lib_location_LIB}")
    
        get_property(fancy_lib_location TARGET "${get_fancy_lib_location_LIB}" PROPERTY LOCATION)
        message (STATUS "fancy_lib_location == ${fancy_lib_location}")
    
        set(${get_fancy_lib_location_LOCATION} ${fancy_lib_location})
    endfunction()
    

提交回复
热议问题