[CMake] Include directory issue ... -I are not separated?

Ateljevich, Eli eli at water.ca.gov
Wed Jun 20 14:05:50 EDT 2012


I appreciate your patience as I seem to be struggling reporting some of the details properly. The real invocation is and has always been this:
cmake -DCMAKE_Fortran_COMPILER=mpif90 ../src

The CMakeLists.txt is below verbatim.
1. If I change to curly braces I get no -I in the compile command at all and the environment variable evaluates empty. 
2. If I go back to parentheses I get the "double -I" problem as before.
3. If I ditch environement variables entirely the file compiles and I am on to the next error: 
include_directories (. /usr/local/dms/pkg/netcdf/4.1.3-intel12.0-parallel/include)

Interestingly, if I don't include the "." the next error has to do with not having the local build directory (src/Hydro) on the include path. So I guess I really do want both parts of the -I, I just don't want them glommed together.

Thanks again,
Eli


=========== file CMakeLists.txt
add_library(Hydro bktrk_subs.F90 elfe_glbl.F90 elfe_msgp.F90 grid_subs.F90 hydraulic_structures.F90 io_subs.F90 lap.F90 misc_subs.F90 sflux_9c.F90 solver_subs.F90 transport.F90)

include_directories ( ${NETCDF_INC} )

add_executable ( pelfe elfe_main.F90 )

target_link_libraries (pelfe Hydro ${NETCDF_LIB} )

Curly-brace Output:

[ 33%] Building Fortran object Hydro/CMakeFiles/Hydro.dir/sflux_9c.F90.o
cd /home/eli/work/selfe_cmake/build/Hydro && /usr/local/dms/pkg/openmpi/1.4.3-intel12.0/bin/mpif90  -o CMakeFiles/Hydro.dir/sflux_9c.F90.o   -c /home/eli/work/selfe_cmake/src/Hydro/sflux_9c.F90

[ 33%] Building Fortran object Hydro/CMakeFiles/Hydro.dir/sflux_9c.F90.o
cd /home/eli/work/selfe_cmake/build/Hydro && /usr/local/dms/pkg/openmpi/1.4.3-intel12.0/bin/mpif90  -o CMakeFiles/Hydro.dir/sflux_9c.F90.o  -I/home/eli/work/selfe_cmake/src/Hydro/-I/usr/local/dms/pkg/netcdf/4.1.3-intel12.0-parallel/include   -c /home/eli/work/selfe_cmake/src/Hydro/sflux_9c.F90







-----Original Message-----
From: Eric Noulard [mailto:eric.noulard at gmail.com] 
Sent: Wednesday, June 20, 2012 9:58 AM
To: Ateljevich, Eli
Cc: cmake at cmake.org
Subject: Re: [CMake] Include directory issue ... -I are not separated?

2012/6/20 Ateljevich, Eli <eli at water.ca.gov>:
> Addendum: I should add that by now I have taken the failure line, put a space in between the two -I components and run it directly in the shell and verified it compiles fine (and without the space it fails as in cmake).

Yes right. Collating -I shall fail, no problem.
The question is why your CMakeLists.txt is generating such command line?

As always evil may be in the details.
Would you be able to copy/attach your CMakeLists.txt "verbatim"?

Your previous quote shall not work since
$(NETCDF_INC) is not a proper CMake syntax
CMake uses braces i.e. ${NETCDF_INC} and not parenthesis.

cmake -DCMAKE_Fortran_COMPILER ../src

is wrong as well (no compiler value defined)
and is probably not the good way to chose the Fortran compiler.

Please give us "exact" content (which may be an excerpt) of your
CMakeLists.txt and command lines used.




-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org



More information about the CMake mailing list