Hi Alex, I've written a very small work-around for my problem.
I noted that 'enable_language(Fortran)' sets the compiler to CMAKE_Fortran_COMPILER-NOTFOUND, whereas 'enable_language(Fortran OPTIONAL) sets it to the empty string. So what I do now is check whether CMAKE_Fortran_COMPILER is defined and matches the empty string, and if so, I set it to CMAKE_Fortran_COMPILER-NOTFOUND. I had expected that I should set it as a cache variable, but it only seems to work if I set it as a normal variable. # Work-around for CMake issue #9220 if(DEFINED CMAKE_Fortran_COMPILER AND CMAKE_Fortran_COMPILER MATCHES "^ $") set(CMAKE_Fortran_COMPILER CMAKE_Fortran_COMPILER-NOTFOUND) endif(DEFINED CMAKE_Fortran_COMPILER AND CMAKE_Fortran_COMPILER MATCHES "^$") I'll add this work-around to the notes for issue #9220. Best regards, Marcel Loose. On Thu, 2009-11-26 at 16:12 +0100, Marcel Loose wrote: > Hi Alex, > > On second thought: the problem I encountered is somewhat different than > the one described in issue #9220. The problem there is that the compiler > name "gcc whatever" is interpreted as compiler "gcc" with an argument > "whatever". > > In my case I do not set a compiler from the command line. I use > 'enable_language(Fortran OPTIONAL)' and let CMake search for the Fortran > compiler. Since there's no Fortran compiler installed, CMake will not > find it. So far, so good. But, when I run CMake a second time, I get the > error I reported. > > What's your thought on this? > > Best regards, > Marcel Loose. > > > On Wed, 2009-11-25 at 19:16 +0100, Alexander Neundorf wrote: > > On Wednesday 25 November 2009, Marcel Loose wrote: > > > Hi Alex, > > > > > > Maybe I'm overlooking all kinds of side effects, but the problem is in > > > line 6 of CMakeFortranInformation.cmake, where get_filename_component() > > > is called with an incorrect number of arguments. This happens because > > > ${CMAKE_Fortran_COMPILER} is empty. If I simply put quotes around > > > ${CMAKE_Fortran_COMPILER} the problem is solved. Or so it seems. Right, > > > or wrong? > > > > I think there's more to it IIRC, the rest of the enable-language process > > has > > to be canceled correctly, which is probably not the case with your fix. > > But please put this comment in the bugtracker, so it doesn't get lost. > > > > Alex > > _______________________________________________ > 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 _______________________________________________ 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