Let us have a look at our CMakeLists.txt:
- We first declare a Fortran project:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)project(recipe-05 LANGUAGES Fortran)
- This example depends on the Python interpreter so that we can execute the helper scripts in a portable fashion:
find_package(PythonInterp REQUIRED)
- In this example, we default to the "Release" build type so that CMake adds optimization flags so that we have something to print later:
if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)endif()
- Now, we define the executable target:
add_executable(example "")target_sources(example PRIVATE example.f90 )
- We then define a custom command to print the link line before the example target ...