Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:47:35+00:00 2026-06-12T09:47:35+00:00

As good as cmake is claimed to be, its documentation seems to leave a

  • 0

As good as cmake is claimed to be, its documentation seems to leave a lot to be desired (unless I’m totally failing at understanding the basics).

I’m trying to write a cmake file for a set of fortran programs which also depend on some other libraries (which are already compiled for my system, but I will want to make a cmake file for these libraries too).

A lot of the commands which I’ve found in examples online don’t appear in the official docs, which is a bit disconcerting.. for example, http://www.vtk.org/Wiki/CMakeForFortranExample contains the line

get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)

yet when I include this in my own CMakeLists.txt I get an error

Missing variable is:
CMAKE_fortran_COMPILER

What am I missing?!

Edit: current CMakeLists.txt

cmake_minimum_required(VERSION 2.6)

enable_language(fortran)
project(fortranTest)
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)

Edit 2

I still haven’t worked out how to include dependent libraries.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:47:36+00:00Added an answer on June 12, 2026 at 9:47 am

    The language names are case sensitive. As posted, I get:

    ~/cmt> cmake ./
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_fortran_COMPILER_ENV_VAR
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_fortran_COMPILER
    CMake Error: Could not find cmake module file:/home/tgallagher/cmt/CMakeFiles/CMakefortranCompiler.cmake
    CMake Error: Could not find cmake module file:CMakefortranInformation.cmake
    CMake Error: CMAKE_fortran_COMPILER not set, after EnableLanguage
    -- The C compiler identification is GNU
    -- The CXX compiler identification is GNU
    -- Check for working C compiler: /usr/bin/gcc
    -- Check for working C compiler: /usr/bin/gcc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    ^C
    

    However, by changing the file to (note it is Fortran and not fortran in enable_language():

    cmake_minimum_required(VERSION 2.6)
    
    enable_language(Fortran)
    project(fortranTest)
    get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
    

    You get:

    ~/cmt> cmake ./
    -- The Fortran compiler identification is GNU
    -- Check for working Fortran compiler: /usr/bin/gfortran
    -- Check for working Fortran compiler: /usr/bin/gfortran  -- works
    -- Detecting Fortran compiler ABI info
    -- Detecting Fortran compiler ABI info - done
    -- Checking whether /usr/bin/gfortran supports Fortran 90
    -- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
    -- The C compiler identification is GNU
    -- The CXX compiler identification is GNU
    -- Check for working C compiler: /usr/bin/gcc
    ^C
    

    Which, if permitted to finish, would work as expected. However, there are better ways to identify the compiler for the purposes of determining compiler flags. The method used in the cited example only works on systems where the compiler is not wrapped, which means systems that don’t invoke the compiler through something like mpif90 or ftn on Cray. A better method is to check:

    if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
    ...
    endif()
    

    The list of possible names can be found by inspecting the file in the CMake Module directory Modules/CMakeFortranCompilerId.F.in

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't find any good documentation on the linkable behaviour for cakephp. I'm trying
Good evening guys. I'm currently trying to get started on development of a project
I'm trying to add the item <key>UIStatusBarHidden</key><true/> to my plist that's auto-generated by CMake.
I am trying to determine if the version of wxWidgets found by CMake is
I am trying to build a big project with CMake but I struggle on
So there seems to be a lot of writing on the subject of Autotools
I m trying to find good reference for how to do JPA project (with
I am currently developing a library, HAMMER , and using CMake as its build
Good morning, I have mysql queries where I would like to calculate percentage of
Good day. I need to teach Windows CryptoAPI to encrypt the message with private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.