Kelly

> First, I wrote a set of macros that would determine the how FC names module
> files (evidently there is no standard naming scheme) by using the
> try_compile() macro.    Next, I created a macro that would take a list of
> Fortran sources and return a list of 'predicted' module file names based on
> the naming scheme discovered in step 1.  Once I had the list of module file
> names, I could use the standard install() command to place them in the

Well I thought about this for a while and tried and failed to make it work 
using various methods, but finally had success doing this.

Step 1: make sure that you use the following so that all module files go into a 
single (hopefully unique) place

SET (CMAKE_Fortran_MODULE_DIRECTORY
    ${PROJECT_BINARY_DIR}/bin/fortran CACHE PATH "Single Directory for all 
fortran modules."
)

Step 2: This has been tested on win32 (visual studio) and gcc linux, and is ok. 
It just adds an install rule to copy the whole fortran module folder across. 
Simple, but fiendishly clever.

# The install rule below copies compiled module files to the install location
# using a "code" rule. The code string should not be broken up, it must be on 
one line
INSTALL ( CODE
  "EXECUTE_PROCESS (COMMAND \"${CMAKE_COMMAND}\" -E copy_directory 
\"${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}\" 
\"${CMAKE_INSTALL_PREFIX}/fortran\")"
)

The {BUILD_TYPE} var is needed as visual studio adds release/debugwithrelinfo 
/etc to paths. May need some tweaking if any platforms do something else odd. 
Becasue the install rule is evaluated by cmake as a cmake script at install 
time, it inserts the right value.

ttfn

JB
_______________________________________________
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

Reply via email to