Re: [CMake] CheckFortranSourceCompiles alternative for cmake 2.8.12

2016-02-23 Thread victor sv
HI again,

I'm using TRY_COMPILE in a MPI Fortran project with CMake 2.8.11 to check
if the mpi.mod file is compatible with the current Fortran compiler.

The CMake code snippet is as follows:

...
FIND_PATH(MPI_MOD_FOUND mpi.mod  PATHS ${MPI_Fortran_INCLUDE_PATH})
IF(MPI_MOD_FOUND)
TRY_COMPILE(FORTRAN_COMPILER_MATCH_MPI_MOD
${PROJECT_BINARY_DIR}
${SERIAL_TESTS_PATH}/try_compile_mpi_mod.f90
CMAKE_FLAGS

"-DINCLUDE_DIRECTORIES:STRING=${MPI_Fortran_INCLUDE_PATH}"
"-DLINK_LIBRARIES:STRING=${MPI_Fortran_LIBRARIES}")
...

And the Fortan code of try_compile_mpi_mod.f90 is:

program test
use mpi
end program

this is the best choice to ensure the compatibility of current Fortran
compiler and the Fortran compiler used to compile the linked MPI library?

Thanks in advance.

Best regards,
Víctor



2016-02-23 12:46 GMT+01:00 victor sv <victo...@gmail.com>:

> Thanks Pter!
>
> Is the solution I was looking for. Great, it works as expected! :)
>
>
> 2016-02-23 12:31 GMT+01:00 Petr Kmoch <petr.km...@gmail.com>:
>
>> Hi Victor,
>>
>> have a look at the try_compile() command (
>> https://cmake.org/cmake/help/v2.8.12/cmake.html#command:try_compile ),
>> especially the second signature (the one which takes SOURCES).
>>
>> Petr
>>
>> On Tue, Feb 23, 2016 at 11:56 AM, victor sv <victo...@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I've seen that in CMake 3.0 appeared the nice CheckFortranSourceCompiles
>>> feature.
>>>
>>> Currently, common SO's like Ubuntu 14 includes CMake 2.8.12.2, but not
>>> CMake 3.0 or higher. I would like to check if a very small Fortran test
>>> program compiles using CMake 2.8.12.2, is this possible? how can i do that?
>>>
>>> Best regards,
>>> Víctor.
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more
>>> information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/cmake
>>>
>>
>>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] CheckFortranSourceCompiles alternative for cmake 2.8.12

2016-02-23 Thread victor sv
Hi all,

I've seen that in CMake 3.0 appeared the nice CheckFortranSourceCompiles
feature.

Currently, common SO's like Ubuntu 14 includes CMake 2.8.12.2, but not
CMake 3.0 or higher. I would like to check if a very small Fortran test
program compiles using CMake 2.8.12.2, is this possible? how can i do that?

Best regards,
Víctor.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CheckFortranSourceCompiles alternative for cmake 2.8.12

2016-02-23 Thread victor sv
Thanks Pter!

Is the solution I was looking for. Great, it works as expected! :)


2016-02-23 12:31 GMT+01:00 Petr Kmoch <petr.km...@gmail.com>:

> Hi Victor,
>
> have a look at the try_compile() command (
> https://cmake.org/cmake/help/v2.8.12/cmake.html#command:try_compile ),
> especially the second signature (the one which takes SOURCES).
>
> Petr
>
> On Tue, Feb 23, 2016 at 11:56 AM, victor sv <victo...@gmail.com> wrote:
>
>> Hi all,
>>
>> I've seen that in CMake 3.0 appeared the nice CheckFortranSourceCompiles
>> feature.
>>
>> Currently, common SO's like Ubuntu 14 includes CMake 2.8.12.2, but not
>> CMake 3.0 or higher. I would like to check if a very small Fortran test
>> program compiles using CMake 2.8.12.2, is this possible? how can i do that?
>>
>> Best regards,
>> Víctor.
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] How to know the MPI Fortran compiler vendor

2016-02-22 Thread victor sv
Hi all,

we need to force some compilation flags for a library compiled with the
MPI_Fortran_COMPILER provided by find_pakage.

With the CMAKE_Fortran_COMPILER we can ask for the compiler vendor checking
the CMAKE_Fortran_COMPILER_ID variable.

There is a way to do the same with MPI_Fortran_COMPILER?

Best regards,
Víctor.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CheckLibraryExists behaviour with different compilers

2015-04-20 Thread victor sv
Hello again,

Sometimes we don't have control on external libraries compilation and we
don't know which compiler was used to generate external libraries

now my questions is, Is there a CMake-standard-way to proceed in these
cases?

What is the best way to specify dependencies depending on the compiler?

Thanks in advance.

Víctor.

2015-04-20 12:57 GMT+02:00 victor sv victo...@gmail.com:

 Ok  Nils,

 thanks for your help :)

 Best regards,
 Víctor.

 2015-04-20 12:33 GMT+02:00 Nils Gladitz nilsglad...@gmail.com:

 On 04/20/2015 12:28 PM, victor sv wrote:

 After googling and reading this:


 http://www.opal-rt.com/kb-article/undefined-reference-intel-fast-memset-build-error-related-rte-delay

 I try to link against libirc.a and libimf.a and it works fine. I do
 other test compiling a shared METIS library with Intel compilers and it
 works too.

 There is something that I'm not well understanding ... If I build a
 static library, even with Intel compilers,shouldn't this library contain
 all the needed symbols?


 A static library is basically a container of object files.
 Library dependencies are normally neither included within that container
 nor are they recorded.

 Nils



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CheckLibraryExists behaviour with different compilers

2015-04-20 Thread victor sv
Thanks Nils for que quick response!

The error log is as follows (summarized):

Determining if the function METIS_SetDefaultOptions exists in the metis
failed with the following output:
Change Dir: /home/vsande/fempar/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make cmTryCompileExec4124725466/fast
/usr/bin/make -f CMakeFiles/cmTryCompileExec4124725466.dir/build.make
CMakeFiles/cmTryCompileExec4124725466.dir/build
make[1]: se ingresa al directorio
«/home/vsande/fempar/build/CMakeFiles/CMakeTmp»
/usr/bin/cmake -E cmake_progress_report
/home/vsande/fempar/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object
CMakeFiles/cmTryCompileExec4124725466.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=METIS_SetDefaultOptions   -o
CMakeFiles/cmTryCompileExec4124725466.dir/CheckFunctionExists.c.o   -c
/usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec4124725466
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec4124725466.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=METIS_SetDefaultOptions
CMakeFiles/cmTryCompileExec4124725466.dir/CheckFunctionExists.c.o  -o
cmTryCompileExec4124725466
-L/home/vsande/Descargas/metis-5.1.0/build/libmetis -rdynamic -lmetis -lm
-Wl,-rpath,/home/vsande/Descargas/metis-5.1.0/build/libmetis
/home/vsande/Descargas/metis-5.1.0/build/libmetis/libmetis.a(gklib.c.o): En
la función `libmetis__icopy':
/home/vsande/Descargas/metis-5.1.0/libmetis/gklib.c:(.text+0x2b1f):
referencia a `_intel_fast_memmove' sin definir
...
/home/vsande/Descargas/metis-5.1.0/build/libmetis/libmetis.a(memory.c.o):
En la función `gk_zcopy':
/home/vsande/Descargas/metis-5.1.0/GKlib/memory.c:(.text+0x289f):
referencia a `_intel_fast_memmove' sin definir
/home/vsande/Descargas/metis-5.1.0/build/libmetis/libmetis.a(memory.c.o):/home/vsande/Descargas/metis-5.1.0/GKlib/memory.c:(.text+0x312f):
más referencias a `_intel_fast_memmove' sin definir a continuación
/home/vsande/Descargas/metis-5.1.0/build/libmetis/libmetis.a(error.c.o): En
la función `errexit':
/home/vsande/Descargas/metis-5.1.0/GKlib/error.c:(.text+0x45b): referencia
a `__intel_sse2_strlen' sin definir
collect2: error: ld returned 1 exit status
make[1]: *** [cmTryCompileExec4124725466] Error 1
make[1]: se sale del directorio
«/home/vsande/fempar/build/CMakeFiles/CMakeTmp»
make: *** [cmTryCompileExec4124725466/fast] Error 2

After googling and reading this:

http://www.opal-rt.com/kb-article/undefined-reference-intel-fast-memset-build-error-related-rte-delay

I try to link against libirc.a and libimf.a and it works fine. I do other
test compiling a shared METIS library with Intel compilers and it works too.

There is something that I'm not well understanding ... If I build a static
library, even with Intel compilers, shouldn't this library contain all the
needed symbols?

Thanks again :)
Víctor

2015-04-20 11:55 GMT+02:00 Nils Gladitz nilsglad...@gmail.com:

 On 04/20/2015 11:47 AM, victor sv wrote:

   CHECK_LIBRARY_EXISTS(metis METIS_SetDefaultOptions ${METIS_PATH}
 HAVE_METIS_SETDEFAULTOPTIONS)


 [...]


 But if I build my project with GNU compilers and METIS still compiled
 with Intel compilers, CMake says:


 Looking for METIS_SetDefaultOptions in metis - not found


 I'd first check CMakeFiles/CMakeError.log to see why it actually failed.

 Nils

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CheckLibraryExists behaviour with different compilers

2015-04-20 Thread victor sv
Ok  Nils,

thanks for your help :)

Best regards,
Víctor.

2015-04-20 12:33 GMT+02:00 Nils Gladitz nilsglad...@gmail.com:

 On 04/20/2015 12:28 PM, victor sv wrote:

 After googling and reading this:


 http://www.opal-rt.com/kb-article/undefined-reference-intel-fast-memset-build-error-related-rte-delay

 I try to link against libirc.a and libimf.a and it works fine. I do
 other test compiling a shared METIS library with Intel compilers and it
 works too.

 There is something that I'm not well understanding ... If I build a
 static library, even with Intel compilers,shouldn't this library contain
 all the needed symbols?


 A static library is basically a container of object files.
 Library dependencies are normally neither included within that container
 nor are they recorded.

 Nils

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] CheckLibraryExists behaviour with different compilers

2015-04-20 Thread victor sv
Hello all,

i'm using CMake 2.8.12.2 and trying to search a symbol inside METIS library
with:

CHECK_LIBRARY_EXISTS(metis METIS_SetDefaultOptions ${METIS_PATH}
HAVE_METIS_SETDEFAULTOPTIONS)

If METIS library was compiled with Intel compilers and i build my project
with the same compilers CMake says:

Looking for METIS_SetDefaultOptions in metis - found


But if I build my project with GNU compilers and METIS still compiled with
Intel compilers, CMake says:

Looking for METIS_SetDefaultOptions in metis - not found


Is it the expected behaviour?


Someone knows how to do this in a clean/portable way?


Any help would be appreciated.


Best regards,

Víctor.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Check_library_exists don't found a function in a static library

2015-03-13 Thread victor sv
Hello again,

the problem was that the static version of the METIS library must be linked
with the MATH library (libm). After adding:

SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
/path/to/math/library )

it seems that all works fine.

Best regards,
Víctor.



2015-03-10 11:02 GMT+01:00 victor sv victo...@gmail.com:

 Hello all,

 I'm a newbie using CMake and I'm trying to migrate the compilation of a
 fortran project to CMake.

 I'm trying to detect the METIS library with find_library(). Inside my
 FindMETIS.cmake I want to check the existence of some functions to set the
 library version with:

 CHECK_LIBRARY_EXISTS(metis METIS_SetDefaultOptions /path/to/metis
 VARIABLE_NAME)


 If /path/to/metis contains the METIS shared library (libmetis.so) it works
 as expected, but if /path/to/metis only contains the static version of the
 library (libmetis.a) CHECK_LIBRARY_EXISTS cannot found this function...

 I check that the library contains this function with the following result:

 $ nm libmetis.a  | grep -i setdefaultoptions
 0210 T metis_setdefaultoptions
 0220 T metis_setdefaultoptions_
 0230 T metis_setdefaultoptions__
  U METIS_SetDefaultOptions
 0200 T METIS_SETDEFAULTOPTIONS
  U METIS_SetDefaultOptions
 0030 T METIS_SetDefaultOptions


 I don't know if this the expected behaviour of this macro, but anyway I
 need to do this check in both, shared and static library. How can I do this?

 Any help would be appreciated.

 Thanks,
 Víctor.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Check_library_exists don't found a function in a static library

2015-03-10 Thread victor sv
Hello all,

I'm a newbie using CMake and I'm trying to migrate the compilation of a
fortran project to CMake.

I'm trying to detect the METIS library with find_library(). Inside my
FindMETIS.cmake I want to check the existence of some functions to set the
library version with:

CHECK_LIBRARY_EXISTS(metis METIS_SetDefaultOptions /path/to/metis
VARIABLE_NAME)


If /path/to/metis contains the METIS shared library (libmetis.so) it works
as expected, but if /path/to/metis only contains the static version of the
library (libmetis.a) CHECK_LIBRARY_EXISTS cannot found this function...

I check that the library contains this function with the following result:

$ nm libmetis.a  | grep -i setdefaultoptions
 0210 T metis_setdefaultoptions
 0220 T metis_setdefaultoptions_
 0230 T metis_setdefaultoptions__
  U METIS_SetDefaultOptions
 0200 T METIS_SETDEFAULTOPTIONS
  U METIS_SetDefaultOptions
 0030 T METIS_SetDefaultOptions


I don't know if this the expected behaviour of this macro, but anyway I
need to do this check in both, shared and static library. How can I do this?

Any help would be appreciated.

Thanks,
Víctor.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake