[CMake] fortran module name issue
Juan E. Sanchez
juan.e.sanchez at gmail.com
Mon Jun 26 16:40:40 EDT 2017
Hi,
It seems like cmake cannot handle the case where the module name is the
result of a macro. I am using this approach to compile the same code
for different floating point precision. Any advice appreciated. This
approach would apply to hundreds of files.
The error is:
Error copying Fortran module "concat". Tried "CONCAT.mod" and "concat.mod".
make[2]: *** [CMakeFiles/flib.dir/baz.o.provides.build] Error 1
make[1]: *** [CMakeFiles/flib.dir/all] Error 2
make: *** [all] Error 2
Regards,
Juan
baz.F:
#include "fmacros.inc"
module CONCAT(baz)
contains
subroutine car(t3)
end subroutine
end module CONCAT(baz)
foo.F:
#include "fmacros.inc"
module CONCAT(foo)
contains
subroutine bar(t1, t2)
use CONCAT(baz)
implicit none
REAL(kind=8) t1
REAL(kind=DWIDTH) t2
call baz(t2)
end subroutine
end module CONCAT(foo)
fmacros.inc:
#define CONCAT(a) a/**/_double
#define DWIDTH 8
main.cc:
extern "C" {
void
}
CMakeLists.txt:
PROJECT(foo)
ENABLE_LANGUAGE(CXX Fortran)
ADD_LIBRARY(flib foo.F baz.F)
More information about the CMake
mailing list