[CMake] Executables with the same name as libs

Ken Martin ken.martin at kitware.com
Thu Jun 16 14:08:54 EDT 2005


After some more brainstorming it seems there is a better way to handle this.
Basically targets must be unique, but you can change the name of the output
produced for executable targets.  This results in something like


# and two targets in the same dir with the same name
ADD_LIBRARY(mytest2 ../Lib1/libc1.c)

ADD_EXECUTABLE(mytest2_exe conly.c)
SET_TARGET_PROPERTIES(mytest2_exe PROPERTIES OUTPUT_NAME mytest2)
TARGET_LINK_LIBRARIES(mytest2_exe mytest2)


This snippet is from the SameName test I just added into CMake (not enabled
yet). The two targets have different target names but by setting the
OUTPUT_NAME property on mytest2_exe we can make the executable produced be
called just mytest2. I have committed these changes for Makefiles, VS7 and
untested in VS6, although there are probably some gotchas still in there.
This seems much cleaner.

Thanks
Ken



More information about the CMake mailing list