I would like to have create a poor-man's template module in Fortran by using 
the preprocessor and #include.   The generic logic will go in the include file, 
and the various top-level files will define tokens to instantiate specific 
implementations.   A very simple example is the following:

!----------------------
! <IntegerVersion.F90>
#define _TYPE integer
#define MODULE_NAME Integer_mod
#include <generic.h>
!----------------------

!----------------------
! <generic.h>
module MODULE_NAME
    _TYPE :: i
…
end module MODULE_NAME
!----------------------

The problem is that CMake does not realize that module has been renamed via the 
preprocessor and still tries to find a .mod file called MODULE_NAME.mod:   
"Error copying Fortran module module_name" …

How can I notify CMake that the module has a different name than what it finds 
in the source code?   I have tried using set_property() on the top file, but 
that does not seem to help. 

I am aware that with the simple example above, I could move the module 
declaration up to the top level and circumvent this problem.  But the include 
file is itself being automatically generated.

Thanks.






-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to