2008/1/14, Vladimir Pouzanov <[EMAIL PROTECTED]>:
> I have a project consisting of two binaries build from same source (they do
> differ in one .cpp file though).
>
> Is it possible to set ADD_DEFINITIONS on per-executable basis somehow? I need 
> to
> add a define specifying which binary type is being built.


Look at SET_TARGET_PROPERTIES
         i.e. the COMPILE_FLAGS

for example
ADD_EXECUTABLE(first source1.cpp source2.cpp)
SET_TARGET_PROPERTIES(first PROPERTIES
                                            COMPILE_FLAGS "-D_FIRST")

ADD_EXECUTABLE(second source1.cpp source2.cpp)
SET_TARGET_PROPERTIES(second PROPERTIES
                                            COMPILE_FLAGS "-D_SECOND")

should be OK.

SET_SOURCE_FILES_PROPERTIES may be useful too
if the compile flags may be attached to the source and not
to the target. This is not the case you described but I found
it usefull too.

-- 
Erk
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to