[CMake] ADD_DEPENDS Fortran only
Karl Merkley
karl at elemtech.com
Fri Nov 11 17:20:49 EST 2005
On Nov 11, 2005, at 2:53 PM, William A. Hoffman wrote:
>
>>
>> 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
>
>
Actually, in the real case I am building a library. It contains
several hundred Fortran files with just a few C++ files that act as a
wrapper to the library. It is much more convenient to create the
single library than it would be to create two sets of libraries. I
have the whole thing working right now, I was just looking for
optimizations to the CMakeLists.txt and was looking for a better
understanding of mixed language projects. I would recommend specifying
the limitations of mixed language projects but not necessarily
discouraging the functionality. It is _very_ useful to be able to do
this kind of thing in CMake.
Karl
More information about the CMake
mailing list