[CMake] have problem when I precompile *.f90 with -fpp using ifort

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Sat Jul 21 03:46:38 EDT 2012


Hi,

Just a wild guess here. Since people often write fortran code starting from 
column 7, they tend to forget that preprocessor statements have to start at 
column 1 (I'm talking from personal head-scratching)... Do you have any spaces 
before the #? If so, remove them and try again.

It does sound like cmake is doing what you ask it to, since it is recognizing 
it as a preprocessor statement.
Cheers,
Yngve

On Saturday 21. July 2012 15.18.39, Lei Pan wrote:

Hello: I have two files: main.f90, mod_a.f90.
in mod_a.f90
---------------------------------
MODULE mod_a
...
#ifdef PSV
...
#endif
...
END
---------------------------------
part of my CMakeLists:
--------------------------------------------------------------------------------------------------
add_library(mod mod_a.f90)
add_definitions(-DPSV)


add_executable(main main.f90)
target_link_libraries(main ${NETCDF_FORTRAN_LIB} mod)
set_target_properties(main PROPERTIES COMPILE_FLAGS "-fpp")
-------------------------------------------------------------------------------------------------


make output:
**/**/mod_a.f90(15): warning #5117: Bad # preprocessor line
#ifdef PSV
-^
**/**/mod_a.f90(20): warning #5117: Bad # preprocessor line
#endif
-^


how to write the CMakeLists.txt in the situation?


Thank you!





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120721/bbb6783d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120721/bbb6783d/attachment.pgp>


More information about the CMake mailing list