PROJECT(FOO) ADD_LIBRARY(bar SHARED bar1.cxx bar2.cxx ) ADD_EXECUTABLE(foo foo.cxx) TARGET_LINK_LIBRARIES(foo dl)