PCH+ifort: cmake_pch.cxx.o created instead of cmake_pch.hxx.gch when language Fortran is added to project and ifort detected.
With next code there is no error.
project(test CXX)
target_precompile_headers(${PROJECT_NAME} PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/stdafx-UnitTest.h>"
)
add_executable(... only cpp)
But when I change project to
project(test CXX Fortran)
cmake detects ifort and leads to next error on linking executable on linux with g++.
cmake_pch.cxx.o: file not recognized: File format not recognized
With further investigation I found that. with adding Fortran language cmake builds cmake_pch.cxx.o target instead of cmake_pch.hxx.gch for CXX language.
CMake should build gch in both cases.
I'm using CMake 3.17.2 with GCC 5.3.
Edited by Pavel Liavonau