How to use the same name for a target and a library

You can set OUTPUT_NAME on a target to modify its basename. So:

add_library(foobar)
add_executable(foobar_exe)
set_property(TARGET foobar_exe PROPERTY OUTPUT_NAME foobar)
2 Likes