We will now discuss the corresponding CMake structure:
- The top-level CMakeLists.txt is similar to Recipe 7; we only exchange CXX for Fortran and remove the C++11 requirement:
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)project(recipe-09 LANGUAGES Fortran)include(GNUInstallDirs)set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})# defines targets and sourcesadd_subdirectory(src)# contains an "external" library we will link toadd_subdirectory(external)# enable testing and define testsenable_testing()add_subdirectory(tests)
- Targets and sources ...