[CMake] cmake gfortran project question
Michael Hertling
mhertling at online.de
Sat Nov 6 10:46:01 EDT 2010
On 11/05/2010 07:21 PM, luxInteg wrote:
> Greetings,
>
> I have a little learning progect using cmake with gfortran.
>
> SOURCE files: aaaa.f, bbbb.f xxx.f and yyyy.f zzzz.y
>
> I want to do the following:-
>
>
> a) create a shared library libFFF.so and a static one libFFF.a (from say
> xxx.f and yyy.f)
ADD_LIBRARY(FFF-shared SHARED xxx.f yyy.f)
ADD_LIBRARY(FFF-static STATIC xxx.f yyy.f)
SET_TARGET_PROPERTIES(FFF-shared FFF-static PROPERTIES OUTPUT_NAME FFF)
> b) find installed fortran librar(ies) say libOLD.a libOLD.so and
> link libOLD.so to libFFF.so
FIND_LIBRARY(OLD-static libOLD.a ...)
FIND_LIBRARY(OLD-shared libOLD.so ...)
TARGET_LINK_LIBRARIES(FFF-shared ${OLD-shared})
> c) when creating libFFF.a tell compiler to compile in libOLD.a
TARGET_LINK_LIBRARIES(FFF-static ${OLD-static})
> d) compile zzzz.f, aaaa.f into executible AAA to link in libFFF.so
ADD_EXECUTABLE(AAA zzzz.f aaaa.f)
TARGET_LINK_LIBRARIES(AAA FFF-shared)
> e) compile bbbb.f into executible BBB and compile in libFFF.a
ADD_EXECUTABLE(BBB bbbb.f)
TARGET_LINK_LIBRARIES(BBB FFF-static)
> I am a novice at cmake and some helo with a)-e) would be appreciated.
In short and not tested.
Regards,
Michael
More information about the CMake
mailing list