[CMake] ADD_DEPENDS Fortran only

William A. Hoffman billlist at nycap.rr.com
Fri Nov 11 16:53:19 EST 2005


>
>Now, I want to add a define to the Fortran only.   It looks like a
>
>ADD_DEFINITIONS(-DTEST_DEFINE)
>
>will be added to the C++ compile line also.  How do I define this only for the Fortran?  Is the best way to just do something like
>
>SET(CMAKE_Fortran_FLAGS "-DTEST_DEFINE")

You could try:

SET_SOURCE_FILE_PROPERTIES(foo.f PROPERTIES COMPILE_FLAGS -DTEST_DEFINE)

At the end of the day it may not be a good idea to have fortran and c or c++ mixed
in the same library or executable.  Create libraries for fortran and link to them,
but do not try and mix the source code into the same library.

-Bill



More information about the CMake mailing list