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
Try:
get_property(fancy_lib_location TARGET fancy_lib PROPERTY LOCATION)
message (STATUS "fancy_lib_location == ${fancy_lib_location}")
Where fancy_lib is the target created with add_library (fancy_lib SHARED ...).
I found that works directly with Makefile generators, but there is more work to be done for Visual Studio generators since the value of fancy_lib_location is not what you would expect:
fancy_lib_location will contain an embedded reference to a Visual-Studio-specific $(OutDir) reference that you will have to replace with the value of the CMAKE_BUILD_TYPE CMake variable (which resolves to something like Debug, or Release).CMAKE_DEBUG_POSTFIX variable, then it will not be included in the value (which may or may not be a bug, I don't know).