In our CMakeLists.txt, we first have to collect the configuration options, and can then substitute their values for the corresponding placeholders in print_info.c.in; we compile both the Fortran and C sources into one executable:
- We create a mixed Fortran-C project, as follows:
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) project(recipe-01 LANGUAGES Fortran C)
- We obtain the username for the user configuring the project by using execute_process:
execute_process( COMMAND whoami TIMEOUT 1 OUTPUT_VARIABLE _user_name OUTPUT_STRIP_TRAILING_WHITESPACE )
- Using the cmake_host_system_information() function (which we already encountered in Chapter 2, Detecting the Environment, Recipe 5, Discovering the host processor instruction ...