title: cmake for Fortran program with module and external libraries
body: <p>I'm trying to write a cmake lists for my Fortran project with one external module, and both have to be linked with an external library that doesn't have any cmake find (findlib) packages. So far, my CMakeLists.txt looks like this:</p>
  
  <pre><code>cmake_minimum_required (VERSION 2.6)
  
  project (Project 1)
  
  enable_language (C Fortran)
  
  set(extern_INCLUDE /home/path/lib/libdir/include/)
  set(extern_LIB /home/path/lib/libdir/lib)
  include_directories(${extern_INCLUDE})
  link_directories (${extern_LIB})
  
  add_library(mymodule STATIC mymodule.f90)
  set(main-source_SRC main-source.f)
  add_executable(main-source ${main-source_SRC})
  #the name of the external library located in /home/path/lib/libdir/lib is    libexternlib.so
  target_link_libraries(main-source mymodule externlib) 
  </code></pre>
  
  <p>A libmymodule.a is created and is definitely not necessary (or a shared one for that matter). I don't want to generate them. How can I avoid its generation and still compile mymodule, generating the .o and .mod to be able to link with the main program and the external lib? The equivalent would be to ifort -c to mymodule and ifort to all .o.</p>