[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: Re: [CMake] have problem when I precompile *.f90 with -fpp using ifort
From: Yngve Inntjore Levinsen <yngve.levinsen () gmail ! com>
Date: 2012-07-21 7:46:38
Message-ID: 26332497.TkjWF6biDF () yngve-chakra
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/alternative)]
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 #7 (unknown)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Hi,<br /></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">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.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">It does sound like cmake is \
doing what you ask it to, since it is recognizing it as a preprocessor statement.<br \
/>Cheers,<br />Yngve<br /><br />On Saturday 21. July 2012 15.18.39, Lei Pan wrote:<br \
/></p> <p style=" margin-top:12px; margin-bottom:0px; margin-left:40px; \
margin-right:40px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hello: I \
have two files: main.f90, mod_a.f90.</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">in mod_a.f90</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">---------------------------------</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">MODULE mod_a</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">...</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">#ifdef PSV</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">...</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">#endif</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">...</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">END</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">---------------------------------</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">part of my CMakeLists:</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">--------------------------------------------------------------------------------------------------</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">add_library(mod \
mod_a.f90)</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; \
margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">add_definitions(-DPSV)</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"><br /></p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">add_executable(main main.f90)</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">target_link_libraries(main \
${NETCDF_FORTRAN_LIB} mod)</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">set_target_properties(main PROPERTIES COMPILE_FLAGS \
"-fpp")</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; \
margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">-------------------------------------------------------------------------------------------------</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">make output:</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">**/**/mod_a.f90(15): warning \
#5117: Bad # preprocessor line</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">#ifdef PSV</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">-^</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">**/**/mod_a.f90(20): warning #5117: Bad # preprocessor line</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">#endif</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-^</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br /></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">how to write the \
CMakeLists.txt in the situation?</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Thank you!</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br /></p></body></html>
["signature.asc" (application/pgp-signature)]
--
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic