Hi,<br><br>I'm trying to use fpp preprocessor in a Fortran project built with CMake. For example, <br>I have two source files. The file x.f90 defines module x:<br><br>module x<br>#ifdef ENABLE_Z<br>  use z<br>#endif<br>  implicit none<br>end module x<br><br>The module z used in module x is defined in z.f90 as followed:<br><br>module z<br>  implicit none<br>  integer :: z_a<br>end module z<br><br>Below is the CMakeLists.txt:<br><br>cmake_minimum_required(VERSION 3.1)<br><br>project(foo Fortran)<br><br>set_source_files_properties(x.f90<br>  PROPERTIES<br>  COMPILE_DEFINITIONS "ENABLE_Z"<br>  )<br><br>add_library(mylib<br>  x.f90<br>  z.f90<br>  )<br><br>I use "MinGW Makefile" generator and Intel Parallel Studio XE 2015 to build mylib <br>under windows 7 command console: <br><br>D:\dev\cmake\fortran_depend_fpp\build>cmake -G"MinGW Makefiles" -DCMAKE_Fortran_<br>COMPILER=ifort ..\src<br>-- The Fortran compiler identification is Intel 15.0.2.20150121<br>-- Check for working Fortran compiler: C:/Intel/Composer XE 2015/bin/intel64/ifo<br>rt.exe<br>-- Check for working Fortran compiler: C:/Intel/Composer XE 2015/bin/intel64/ifo<br>rt.exe  -- works<br>-- Detecting Fortran compiler ABI info<br>-- Detecting Fortran compiler ABI info - done<br>-- Checking whether C:/Intel/Composer XE 2015/bin/intel64/ifort.exe supports For<br>tran 90<br>-- Checking whether C:/Intel/Composer XE 2015/bin/intel64/ifort.exe supports For<br>tran 90 -- yes<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: D:/dev/cmake/fortran_depend_fpp/build<br><br>When building library mylib, it failed:<br><br>D:\dev\cmake\fortran_depend_fpp\build>mingw32-make mylib<br>Scanning dependencies of target mylib<br>[ 33%] Building Fortran object CMakeFiles/mylib.dir/x.f90.obj<br>D:\dev\cmake\fortran_depend_fpp\src\x.f90(4): error #7002: Error in opening the<br>compiled module file.  Check INCLUDE paths.   [Z]<br>  use z<br>------^<br>compilation aborted for D:\dev\cmake\fortran_depend_fpp\src\x.f90 (code 1)<br>CMakeFiles\mylib.dir\build.make:61: recipe for target 'CMakeFiles/mylib.dir/x.f9<br>0.obj' failed<br>mingw32-make[3]: *** [CMakeFiles/mylib.dir/x.f90.obj] Error 1<br>CMakeFiles\Makefile2:104: recipe for target 'CMakeFiles/mylib.dir/all' failed<br>mingw32-make[2]: *** [CMakeFiles/mylib.dir/all] Error 2<br>CMakeFiles\Makefile2:117: recipe for target 'CMakeFiles/mylib.dir/rule' failed<br>mingw32-make[1]: *** [CMakeFiles/mylib.dir/rule] Error 2<br>Makefile:130: recipe for target 'mylib' failed<br>mingw32-make: *** [mylib] Error 2<br><br>The reason is that x.f90 is compiled before z.f90. It seems that the makefile doesn't <br>contain the rule about module x's dependency on module z. How could I correct it? <br>Thanks in advance for your suggestions.<br><br>BTW: the "Visual Studio 12 2013" generator works fine.<br><br>