[CMake] How Do I Make A Static Library from FORTRAN and CPP sources?

Peter Willis pwillis at aslenv.com
Fri Mar 1 18:48:50 EST 2013


Hello,

I would like to make a static library from FORTRAN sources (as opposed to
C/C++).

I have  in my CMakeLists.txt :

cmake_minimum_required(VERSION 2.8)
enable_language (Fortran)

PROJECT(MYFORTRANLIB)

get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER}
NAME)

SET(SOMEFORTRAN " libfuncs.F  statsfuncs.F ")
SET(SOMECPP " one_lonely_function.cpp " )

SET(MYSOURCES ${SOMEFORTRAN} ${SOMECPP} )

ADD_LIBRARY(libmyfortran  STATIC  ${MYSOURCES} )


----------------------------------------------------------------------------
----

Is it possible to generate object files for both the CPP file and the
FORTRAN files
in the same build. or do I need to set up 2 directories with a library build
for each?

The CMakeLists.txt file above is not working yet.

Thanks



More information about the CMake mailing list