Skip to content

Ninja: Add source location as include directory for preprocessed files

Nils Gladitz requested to merge nilsgladitz/cmake:ninja-include-dir into master

Fortran INCLUDE statements are not handled by the preprocessor.

Since the location of the preprocessed file is distinct from the original source file explicitly add the source file's directory as an include path so INCLUDE can find it.

This fixes e.g. the following test case (which would otherwise fail because bar.f90 can not be found):

cmake_minimum_required(VERSION 3.6)

project(Testcase Fortran)

file(WRITE foo.f90 [[
INCLUDE "bar.f90"
]])

file(WRITE bar.f90)

add_library(foo STATIC foo.f90)

Merge request reports