[CMake] ADD_DEPENDS Fortran only
Karl Merkley
karl at elemtech.com
Fri Nov 11 16:32:51 EST 2005
So, I have this little mixed C++/Fortran project that I have been
working on . . .
> PROJECT(add_fortran CXX Fortran)
> ADD_EXECUTABLE(add_fortran main.cpp testf1.F testf2.f)
>
> # Must specify which linker to use for a multiple language project
> SET_TARGET_PROPERTIES(add_fortran PROPERTIES LINKER_LANGUAGE CXX)
>
> # Using g77 need to find and link with libg2c
> FIND_LIBRARY(G2C NAMES g2c PATHS /opt/local/lib)
> TARGET_LINK_LIBRARIES(add_fortran ${G2C})
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")
Karl
More information about the CMake
mailing list