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!





Attachment: signature.asc
Description: This is a digitally signed message part.

--

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