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

Ateljevich, Eli eli at water.ca.gov
Wed Jun 20 18:08:13 EDT 2012


Well, thanks to your hints, I did end up resolving this by finding a user error in the environment that would not have affected make. 

So ... worst user post I have ever made, but you did teach me a lot at the beginning about the environment that would have killed me soon enough.

E

-----Original Message-----
From: Ateljevich, Eli 
Sent: Wednesday, June 20, 2012 3:05 PM
To: Ateljevich, Eli; Eric Noulard
Cc: cmake at cmake.org
Subject: RE: [CMake] Include directory issue ... -I are not separated?

Eric
I have improved my envvar usage a bit further, I hope, by saying 
include_directories( $ENV{NETCDF_INC} ) 
rather than 
include_directories( ${NETCDF_INC} )

However, I am now quite sure that what is happening is when I put hardwired absolute paths in include_directories it is used as-is, but when I put in environment variables the project build path is being prepended to it. Can I disable this?

Thanks,
Eli


-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Ateljevich, Eli
Sent: Wednesday, June 20, 2012 11:06 AM
To: Eric Noulard
Cc: cmake at cmake.org
Subject: Re: [CMake] Include directory issue ... -I are not separated?

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

--

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



More information about the CMake mailing list