[CMake] duplicate file name

Eric Noulard eric.noulard at gmail.com
Thu Feb 19 03:03:35 EST 2009


2009/2/18 Nicolas Slythe (Intern) <Nicolas.Slythe at autodesk.com>:
> I'm using CMake 2.4-patch 8
>
> I have an issue with duplicate file name
>
> If I have 2 file with the same name in different folder CMake does not
> process the second one

2 identical **files** in separate folders should not be an issue
however you cannot have
2 identical **target** name.

thus you may not have

ADD_EXECUTABLE(MyExe myexe.cpp) in folder1
and
ADD_EXECUTABLE(MyExe myexe.cpp) in folder2

this is because CMake treats target names "globally"

> Is someone know how I can fix tha or if this issue is fixed in 2.6 version

If your probleme is the **target** name collision problem then you may use the
OUTPUT_NAME target property:

ADD_EXECUTABLE(MyExe_f1 myexe.cpp) in folder1
SET_TARGET_PROPERTIES(MyExe_f1 OUTPUT_NAME MyExe)

ADD_EXECUTABLE(MyExe_f2 myexe.cpp) in folder2
SET_TARGET_PROPERTIES(MyExe_f2 OUTPUT_NAME MyExe)

this should work both with CMake 2.4.x and 2.6.x

If your problem is not this one please give us more detail.
-- 
Erk


More information about the CMake mailing list