[CMake] CMAKE_SOURCE_DIR overwritten by CMake Fortran language support

Bill Hoffman bill.hoffman at kitware.com
Fri Mar 26 16:34:00 EDT 2010


Alan W. Irwin wrote:
> Hi Brad:
> 
> The PLplot project still uses some special Fortran support files for our
> CMake-2.6.4 users, but we have run into cross-platform problems in that 
> case
> where Linux can access our special location for Fortran Platform files, but
> MinGW cannot.  It has been reported (by Arjen Markus) that the MinGW issue
> is because something in that case overwrites CMAKE_SOURCE_DIR (which
> we are using to help locate our special platform files in our
> version of CMakeFortranInformation.cmake for CMake-2.6.4).
> 
> We are currently trying using CMAKE_HOME_DIRECTORY rather than
> CMAKE_SOURCE_DIR in our version of CMakeFortranInformation.cmake for
> CMake-2.6.4 in hopes that the MinGW CMake Fortran support infrastructure
> will not overwrite that important variable as well.
> 
> These are issues for old versions of CMake that I hope we can work around,
> but I am drawing them to your attention just in case modern CMake also
> overwrites CMAKE_SOURCE_DIR as part of MinGW Fortran support. I just think
> that is a bad idea which I hope you have been able to avoid in modern 
> CMake.
> However, if important CMake variables like this necessarily must be
> overwritten by CMake language support, then that unusual behaviour 
> should be
> documented.
> 
> N.B. For others here I want to make clear that ordinary CMake code does
> not see the effects of the overwriting of CMAKE_SOURCE_DIR for MinGW.
> The effect of that change instead appears to be limited just to files such
> as CMakeFortranInformation.cmake which are part of the CMake-2.6.x language
> support infrastructure, and my question to Brad was whether that strange
> result had also propagated to CMake-2.8.x.
> 

One thing you might want to try is cmake --trace, and then track down 
where the CMAKE_SOURCE_DIR is getting clobbered.

-Bill


More information about the CMake mailing list