I forgot to add that if, immediately after running CMake, I run it again (without changing a single file), the flags "-module foobar" appear in the sub2/.../flags.cmake as well.
Petr On Tue, Feb 12, 2013 at 2:15 PM, Petr Kmoch <petr.km...@gmail.com> wrote: > Hi all. > > I have a problem with Fortran_MODULE_DIRECTORY only being applied in the > first of several subdirectory projects. Here's a simplified setup to > demonstrate the issue. It has a toplevel C++ project and two subdirectory > projects which use Fortran: > > $cat source_dir/CMakeLists.txt: > cmake_minimum_required(VERSION 2.8.7) > > project(Top) # No Fortran here > > add_executable(topper src/main.cpp) > > add_subdirectory(sub) > add_subdirectory(sub2) > ## > > $cat source_dir/sub/CMakeLists.txt: > cmake_minimum_required(VERSION 2.8.7) > > project(Fort Fortran) > > add_executable(exe src/exe.f) > set_target_properties(exe PROPERTIES Fortran_MODULE_DIRECTORY foobar) > ## > > $cat source_dir/sub2/CMakeLists.txt: > cmake_minimum_required(VERSION 2.8.7) > > project(Fort2 Fortran) > > add_executable(exe2 src/exe.f) > set_target_properties(exe2 PROPERTIES Fortran_MODULE_DIRECTORY foobar) > ## > > I run CMake like this: > $cd build_dir > $FC=ifort cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Debug > ../source_dir > > Then, I have this output: > $cat sub/CMakeFiles/exe.dir/flags.make > # CMAKE generated file: DO NOT EDIT! > # Generated by "Unix Makefiles" Generator, CMake Version 2.8 > > # compile Fortran with /some_path_to_ifort/ifort > Fortran_FLAGS = -g -module foobar > > Fortran_DEFINES = > ## > > $cat sub2/CMakeFiles/exe2.dir/flags.make > # CMAKE generated file: DO NOT EDIT! > # Generated by "Unix Makefiles" Generator, CMake Version 2.8 > > # compile Fortran with /some_path_to_ifort/ifort > Fortran_FLAGS = -g > > Fortran_DEFINES = > ## > > The flags "-module foobar" are only present in sub, not in sub2. Am I > doing something wrong, or is that a bug in CMake? > > My real setup doesn't really allow me to enable Fortran in the toplevel > project; is there a way to make this work without that? > > Thanks in advance. > > Petr >
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake