[CMake] BUG?: ExternalProject_add with CMAKE_COMMAND and Re-run cmake

2019-03-12 Thread Xavier Lacoste
Hello,

I use External_project and set up a cmake subproject that uses au specific 
CMAKE_COMMAND (a wrapper that does export environment variables)
This wrapper is correctly called on first configure but not if CMake decides to 
rerun CMake at build step.

[ 45%] Performing build step for 'lap_project'
cd /appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/lap/build-debug && 
/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/make_wrapper_lap.sh
gmake[3]: entrant dans le répertoire « 
/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/lap/build-debug »
/appli_MTS/SIP/devtools/cmake/3.8.2/x86_64/Linux/SUSE11.3/bin/cmake 
-H/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/lap 
-B/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/lap/build-debug 
--check-build-system CMakeFiles/Makefile.cmake 0
Re-run cmake file: Makefile older than: 
/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/lap/test/CMakeLists.txt

My only workaround is to rm the project subdirectory and rerun make (in that 
case the wrapper is used):
[ 50%] Performing configure step for 'lap_project'
cd /appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/lap/build-debug && 
/appli_RD/LACOSTE/OMEGA/cmakesuperbuild/build-gnu-debug/cmake_wrapper_lap.sh

I tried passing -DCMAKE_COMMAND=mywrapper.sh but it only raise a warning saying 
that this variable was not used by the project.

IMHO it’s a but in ExternalProject_add(). Correct ?

Any advice or help is welcome.

Regards,

XL.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] CMAKE_RULE_LAUNCH_LINK separate link binary and archive

2017-10-05 Thread xavier lacoste
Hello,

I would like to use CMAKE_RULE_LAUNCH_LINK/CMAKE_RULE_LAUNCH_COMPILE for
using score-p.

scorep should be added in compile and link line before compiler (eg. scorep
gcc).
Thus I setted CMAKE_RULE_LAUNCH_COMPILE to scorep and same for
CMAKE_RULE_LAUNCH_LINK. (set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK
 scorep))
(set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE scorep))

The issue is that scorep is also added for ARCHIVE creation with "ar" which
is not supported by score-p.

Do you have a solution to prefix link for an executable and not for an
archive ?

Regards,

XL
-- 

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] fortran module name issue

2017-06-26 Thread xavier lacoste
Hello,

You could also concatenate words with gfortran preprocessor using :

#define PASTE(a) a
#define CONCAT(a,b) PASTE(a)b

My two cents,

XL

Le 27 juin 2017 4:01 AM, "Juan E. Sanchez"  a
écrit :

> Hi Burlen,
>
> Thanks for your response, it inspired me to do something similar.
>
> Starting with the non-processed files, I used the code below.  It also
> seems to track the mod file dependencies correctly, but I need to
> thoroughly test it.
>
> Note that I had to use the cpp command with brew (on mac os x) to
> concatenate the tokens without spaces.  The linux cpp at work should also
> be able to handle the traditional-cpp required.
>
> Regards,
>
> Juan
>
>
> PROJECT(foo)
> ENABLE_LANGUAGE(CXX Fortran)
>
> SET(TFILES foo baz)
>
> SET(FFILES "")
> FOREACH(I ${TFILES})
>   SET(THISFILE ${I}_double.F)
> ADD_CUSTOM_COMMAND (
>   OUTPUT ${CMAKE_SOURCE_DIR}/${THISFILE}
>   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
>   COMMAND /usr/local/bin/cpp-7
>   ARGS-traditional-cpp -P ${I}.F > ${THISFILE}
>   DEPENDS ${I}.F
> )
> LIST(APPEND FFILES ${THISFILE})
> ENDFOREACH(I)
>
> ADD_LIBRARY(flib ${FFILES})
> SET_SOURCE_FILES_PROPERTIES(${FFILES} PROPERTIES GENERATED TRUE)
> MESSAGE(INFO ${FFILES})
>
>
> ADD_EXECUTABLE(main main.cc)
> TARGET_LINK_LIBRARIES(main flib)
>
>
> On 6/26/17 6:06 PM, Burlen Loring wrote:
>
>> Hi Juan,
>>
>> I have faced similar challenges when calling Fortran code from C++
>> templates.
>>
>> In the solution I came up with, I use a marked up Fortran template code
>> and Cmake's configure_file command to generate a module for each
>> combination of C++ types I need. The markup uses a token for each template
>> argument and a decorator that is appended to Fortran symbols and is used in
>> the module and file names to differentiate all of the CMake generated
>> instantiations.
>>
>> here is the relevant Cmake code that does all the work, (note: I have two
>> template arguments one for coordinates and variables):
>>
>> set(teca_alg_f90_srcs)
>>
>> set(teca_alg_f90_generics
>>  gfdl_spline
>>  gfdl_tc_candidates
>>  )
>>
>> set(f_type real)
>> set(c_types float double)
>> foreach(generic_src ${teca_alg_f90_generics})
>>  foreach(c_type_var ${c_types})
>>  set(iso_c_type_var "${f_type}(c_${c_type_var})")
>>  string(SUBSTRING ${c_type_var} 0 1 var_name)
>>  foreach(c_type_coord ${c_types})
>>  string(SUBSTRING ${c_type_coord} 0 1 coord_name)
>>  set(decorator "c${coord_name}_v${var_name}")
>>  set(iso_c_type_coord "${f_type}(c_${c_type_coord})")
>>  configure_file(${generic_src}.f90.in
>> ${generic_src}_${decorator}.f90 @ONLY)
>>  list(APPEND teca_alg_f90_srcs
>> ${generic_src}_${decorator}.f90)
>>  endforeach()
>>  endforeach()
>> endforeach()
>>
>> add_library(teca_alg ${teca_alg_cxx_srcs} ${teca_alg_f90_srcs})
>>
>> And here is a link to an example marked up Fortran template code.
>>
>> https://github.com/LBL-EESA/TECA/blob/master/alg/gfdl_tc_can
>> didates.f90.in
>>
>>  From C++ I use macros to declare decorated Fortran functions and define
>> C++ overloads that call them.
>>
>> https://github.com/LBL-EESA/TECA/blob/master/alg/gfdl_tc_candidates.h
>>
>> It's a bit of a heavy handed solution, but I think you can solve your
>> problem in a similar way. I'm interested in hearing of other approaches
>> that have worked.
>>
>> Burlen
>>
>>
>> On 06/26/2017 01:40 PM, Juan E. Sanchez wrote:
>>
>>> Hi,
>>>
>>> It seems like cmake cannot handle the case where the module name is the
>>> result of a macro.  I am using this approach to compile the same code for
>>> different floating point precision.  Any advice appreciated.  This approach
>>> would apply to hundreds of files.
>>>
>>> The error is:
>>> Error copying Fortran module "concat".  Tried "CONCAT.mod" and
>>> "concat.mod".
>>> make[2]: *** [CMakeFiles/flib.dir/baz.o.provides.build] Error 1
>>> make[1]: *** [CMakeFiles/flib.dir/all] Error 2
>>> make: *** [all] Error 2
>>>
>>>
>>> Regards,
>>>
>>> Juan
>>>
>>>
>>> baz.F:
>>> #include "fmacros.inc"
>>>
>>>   module CONCAT(baz)
>>>   contains
>>>   subroutine car(t3)
>>>   end subroutine
>>>   end module CONCAT(baz)
>>>
>>> foo.F:
>>> #include "fmacros.inc"
>>>
>>>   module CONCAT(foo)
>>>   contains
>>>   subroutine bar(t1, t2)
>>>   use CONCAT(baz)
>>>   implicit none
>>>   REAL(kind=8) t1
>>>   REAL(kind=DWIDTH) t2
>>>   call baz(t2)
>>>   end subroutine
>>>   end module CONCAT(foo)
>>>
>>> fmacros.inc:
>>>
>>> #define CONCAT(a) a/**/_double
>>> #define DWIDTH 8
>>>
>>> main.cc:
>>> extern "C" {
>>> void
>>> }
>>>
>>> CMakeLists.txt:
>>>
>>> PROJECT(foo)
>>> ENABLE_LANGUAGE(CXX Fortran)
>>>
>>> ADD_LIBRARY(flib foo.F baz.F)
>>>
>>>
>>>
>>>
>>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake 

Re: [CMake] Different flags for compiling and linking with Fortran

2017-06-15 Thread xavier lacoste
A solution was to append the options to COMPILE_FLAGS using
set_file_source_property().


Le 15 juin 2017 15:29, "xavier lacoste"  a écrit :

> Hello Chuck,
>
> Indeed I had an old 2.8.12.2 version I upgraded to 3.8.2 and get correct
> detection of xlc.
> But still the same error with xlf linking with -fpp if I have
> FFLAGS="-fpp" :
>
> [lacoste@caimanp8 test]$ cmake --version
> cmake version 3.8.2
>
> CMake suite maintained and supported by Kitware (kitware.com/cmake).
> [lacoste@caimanp8 test]$ module load xlc
> [lacoste@caimanp8 test]$ module load xlf
> [lacoste@caimanp8 test]$ FFLAGS="-cpp" cmake  .
> -- The C compiler identification is XL 13.1.5
> -- The CXX compiler identification is XL 13.1.5
> -- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r
> -- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r
> -- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- The Fortran compiler identification is XL 15.1.5
> -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
> -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
>  -- broken
> CMake Error at /home/lacoste/cmake/share/cmake-3.8/Modules/
> CMakeTestFortranCompiler.cmake:44 (message):
>   The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to
>   compile a simple test program.
>
>   It fails with the following output:
>
>Change Dir: /home/lacoste/test/CMakeFiles/CMakeTmp
>
>
>
>   Run Build Command:"/usr/bin/gmake" "cmTC_38cf1/fast"
>
>   /usr/bin/gmake -f CMakeFiles/cmTC_38cf1.dir/build.make
>   CMakeFiles/cmTC_38cf1.dir/build
>
>   gmake[1]: Entering directory `/home/lacoste/test/CMakeFiles/CMakeTmp'
>
>   Building Fortran object CMakeFiles/cmTC_38cf1.dir/
> testFortranCompiler.f.o
>
>   /opt/ibm/xlf/15.1.5/bin/xlf90_r -cpp -qthreaded -qhalt=e -c
>   /home/lacoste/test/CMakeFiles/CMakeTmp/testFortranCompiler.f -o
>   CMakeFiles/cmTC_38cf1.dir/testFortranCompiler.f.o
>
>   ** testfortran === End of Compilation 1 ===
>
>   1501-510 Compilation successful for file testFortranCompiler.f.
>
>   Linking Fortran executable cmTC_38cf1
>
>   /home/lacoste/cmake/bin/cmake -E cmake_link_script
>   CMakeFiles/cmTC_38cf1.dir/link.txt --verbose=1
>
>   /opt/ibm/xlf/15.1.5/bin/xlf90_r -Wl,-export-dynamic -cpp -qthreaded
>   -qhalt=e CMakeFiles/cmTC_38cf1.dir/testFortranCompiler.f.o -o cmTC_38cf1
>
>   /opt/ibm/xlf/15.1.5/bin/.orig/xlf90_r: 1501-294 (S) No input file
>   specified.  Please use -qhelp for more information.
>
>   gmake[1]: *** [cmTC_38cf1] Error 249
>
>   gmake[1]: Leaving directory `/home/lacoste/test/CMakeFiles/CMakeTmp'
>
>   gmake: *** [cmTC_38cf1/fast] Error 2
>
>
>
>
>
>   CMake will not be able to correctly generate this project.
> Call Stack (most recent call first):
>   CMakeLists.txt:11 (ENABLE_LANGUAGE)
>
>
> -- Configuring incomplete, errors occurred!
> See also "/home/lacoste/test/CMakeFiles/CMakeOutput.log".
> See also "/home/lacoste/test/CMakeFiles/CMakeError.log".
>
>
> 2017-06-15 15:06 GMT+02:00 Chuck Atkins :
>
>> Hi Xavier,
>>
>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
>>>
>> ...
>>
>>> -- The C compiler identification is Clang 3.8.0
>>> -- The CXX compiler identification is Clang 3.8.0
>>> ...
>>>
>> -- The Fortran compiler identification is XL
>>>
>>
>> What version of CMake are you using?  Give that the C and C++ compilers
>> are detected as Clang then I suspect it's rather old.  They should also be
>> detected as XL like the Fortran compiler.  Do you get the same XL Fortran
>> errors using a new version of CMake?
>>
>> --
>> Chuck Atkins
>> Staff R&D Engineer, Scientific Computing
>> Kitware, Inc.
>>
>>
>>
>>
>>
>
-- 

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] Different flags for compiling and linking with Fortran

2017-06-15 Thread xavier lacoste
Hello Chuck,

Indeed I had an old 2.8.12.2 version I upgraded to 3.8.2 and get correct
detection of xlc.
But still the same error with xlf linking with -fpp if I have FFLAGS="-fpp"
:

[lacoste@caimanp8 test]$ cmake --version
cmake version 3.8.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
[lacoste@caimanp8 test]$ module load xlc
[lacoste@caimanp8 test]$ module load xlf
[lacoste@caimanp8 test]$ FFLAGS="-cpp" cmake  .
-- The C compiler identification is XL 13.1.5
-- The CXX compiler identification is XL 13.1.5
-- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r
-- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r
-- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is XL 15.1.5
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r  --
broken
CMake Error at
/home/lacoste/cmake/share/cmake-3.8/Modules/CMakeTestFortranCompiler.cmake:44
(message):
  The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir: /home/lacoste/test/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/bin/gmake" "cmTC_38cf1/fast"

  /usr/bin/gmake -f CMakeFiles/cmTC_38cf1.dir/build.make
  CMakeFiles/cmTC_38cf1.dir/build

  gmake[1]: Entering directory `/home/lacoste/test/CMakeFiles/CMakeTmp'

  Building Fortran object CMakeFiles/cmTC_38cf1.dir/testFortranCompiler.f.o

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -cpp -qthreaded -qhalt=e -c
  /home/lacoste/test/CMakeFiles/CMakeTmp/testFortranCompiler.f -o
  CMakeFiles/cmTC_38cf1.dir/testFortranCompiler.f.o

  ** testfortran === End of Compilation 1 ===

  1501-510 Compilation successful for file testFortranCompiler.f.

  Linking Fortran executable cmTC_38cf1

  /home/lacoste/cmake/bin/cmake -E cmake_link_script
  CMakeFiles/cmTC_38cf1.dir/link.txt --verbose=1

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -Wl,-export-dynamic -cpp -qthreaded
  -qhalt=e CMakeFiles/cmTC_38cf1.dir/testFortranCompiler.f.o -o cmTC_38cf1

  /opt/ibm/xlf/15.1.5/bin/.orig/xlf90_r: 1501-294 (S) No input file
  specified.  Please use -qhelp for more information.

  gmake[1]: *** [cmTC_38cf1] Error 249

  gmake[1]: Leaving directory `/home/lacoste/test/CMakeFiles/CMakeTmp'

  gmake: *** [cmTC_38cf1/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:11 (ENABLE_LANGUAGE)


-- Configuring incomplete, errors occurred!
See also "/home/lacoste/test/CMakeFiles/CMakeOutput.log".
See also "/home/lacoste/test/CMakeFiles/CMakeError.log".


2017-06-15 15:06 GMT+02:00 Chuck Atkins :

> Hi Xavier,
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
>>
> ...
>
>> -- The C compiler identification is Clang 3.8.0
>> -- The CXX compiler identification is Clang 3.8.0
>> ...
>>
> -- The Fortran compiler identification is XL
>>
>
> What version of CMake are you using?  Give that the C and C++ compilers
> are detected as Clang then I suspect it's rather old.  They should also be
> detected as XL like the Fortran compiler.  Do you get the same XL Fortran
> errors using a new version of CMake?
>
> --
> Chuck Atkins
> Staff R&D Engineer, Scientific Computing
> Kitware, Inc.
>
>
>
>
>
-- 

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] Different flags for compiling and linking with Fortran

2017-06-15 Thread xavier lacoste
Dear Cmake Users,

I could reproduce this with a minimal CMakeLists.txt :

[lacoste@caimanp8 test]$ cat CMakeLists.txt
###
#
  #
# CMake proposal for SABL projects based on Python + libs in C/Fortran
   #
#
  #
###

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)


PROJECT(TOTO)
ENABLE_LANGUAGE (C Fortran)


[lacoste@caimanp8 test]$ FFLAGS="-cpp" cmake .
-- The C compiler identification is Clang 3.8.0
-- The CXX compiler identification is Clang 3.8.0
-- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r
-- Check for working C compiler: /opt/ibm/xlC/13.1.5/bin/xlc_r -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r
-- Check for working CXX compiler: /opt/ibm/xlC/13.1.5/bin/xlC_r -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is XL
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r  --
broken
CMake Error at /usr/share/cmake/Modules/CMakeTestFortranCompiler.cmake:54
(message):
  The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir: /home/lacoste/test/CMakeFiles/CMakeTmp



  Run Build Command:/usr/bin/gmake "cmTryCompileExec1053595571/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec1053595571.dir/build.make
  CMakeFiles/cmTryCompileExec1053595571.dir/build

  gmake[1]: Entering directory `/home/lacoste/test/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /home/lacoste/test/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building Fortran object
  CMakeFiles/cmTryCompileExec1053595571.dir/testFortranCompiler.f.o

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -cpp -qthreaded -qhalt=e -c
  /home/lacoste/test/CMakeFiles/CMakeTmp/testFortranCompiler.f -o
  CMakeFiles/cmTryCompileExec1053595571.dir/testFortranCompiler.f.o

  ** testfortran === End of Compilation 1 ===

  1501-510 Compilation successful for file testFortranCompiler.f.

  Linking Fortran executable cmTryCompileExec1053595571

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec1053595571.dir/link.txt --verbose=1

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -cpp -qthreaded -qhalt=e
  CMakeFiles/cmTryCompileExec1053595571.dir/testFortranCompiler.f.o -o
  cmTryCompileExec1053595571

  /opt/ibm/xlf/15.1.5/bin/.orig/xlf90_r: 1501-294 (S) No input file
  specified.  Please use -qhelp for more information.

  gmake[1]: *** [cmTryCompileExec1053595571] Error 249

  gmake[1]: Leaving directory `/home/lacoste/test/CMakeFiles/CMakeTmp'

  gmake: *** [cmTryCompileExec1053595571/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:11 (ENABLE_LANGUAGE)


-- Configuring incomplete, errors occurred!
See also "/home/lacoste/test/CMakeFiles/CMakeOutput.log".
See also "/home/lacoste/test/CMakeFiles/CMakeError.log".

Regards,

XL


2017-06-15 9:04 GMT+02:00 xavier lacoste :

> Dear cmake users,
>
> For some Fortran compiler we need to remove flags we added to
> CMAKE_Fortran_FLAGS_RELEASE to be able to link (options not recognized at
> link).
>
> Do you have any idea of how to do so ?
>
> A practical case is the xlf90 -cpp flag.
> I have several .f90 files that need preprocessing so I require -cpp
> -qsuffix=cpp=f90 at compile time but it is not supported at link time.
>
> If I use :
> FFLAGS="-g -cpp -qxlf2003=POLYmorphic -qsuffix=cpp=f90 -qextname
> -qdirective='IBM*' -qport=typlssarg"
> I get an error when CMake tries to build a fortran file with XLF :
> -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
> -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
>  -- broken
> CMake Error at /usr/share/cmake/Modules/CMakeTestFortranCompiler.cmake:54
> (message):
>   The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to
>   compile a simple test program.
>
>   It fails with the following output:
>
>Change Dir: /home/lacoste/sabl/build/ppc64le_LinuxRH7.3_
> xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp
>
>
>
>   Run Build Command:/usr/bin/gmake "cmTryCompileExec3078717336/fast"
>
>   gmake[1]: Entering directory
>   `/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_
> xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp'
>
>
>   /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3078717336.dir/build.make
>   CMakeFiles/cmTryCompileExec3078717336.dir/build
>
>   gmake[2]: Entering directory
&g

[CMake] Different flags for compiling and linking with Fortran

2017-06-15 Thread xavier lacoste
Dear cmake users,

For some Fortran compiler we need to remove flags we added to
CMAKE_Fortran_FLAGS_RELEASE to be able to link (options not recognized at
link).

Do you have any idea of how to do so ?

A practical case is the xlf90 -cpp flag.
I have several .f90 files that need preprocessing so I require -cpp
-qsuffix=cpp=f90 at compile time but it is not supported at link time.

If I use :
FFLAGS="-g -cpp -qxlf2003=POLYmorphic -qsuffix=cpp=f90 -qextname
-qdirective='IBM*' -qport=typlssarg"
I get an error when CMake tries to build a fortran file with XLF :
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r
-- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r  --
broken
CMake Error at /usr/share/cmake/Modules/CMakeTestFortranCompiler.cmake:54
(message):
  The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir:
/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp



  Run Build Command:/usr/bin/gmake "cmTryCompileExec3078717336/fast"

  gmake[1]: Entering directory

`/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp'


  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3078717336.dir/build.make
  CMakeFiles/cmTryCompileExec3078717336.dir/build

  gmake[2]: Entering directory

`/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp'


  /usr/bin/cmake -E cmake_progress_report

/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building Fortran object
  CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -g -cpp -qxlf2003=POLYmorphic
  -qsuffix=cpp=f90 -qextname -qdirective='IBM*' -qport=typlssarg -c

/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp/testFortranCompiler.f
  -o CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o

  ** testfortran === End of Compilation 1 ===

  1501-510 Compilation successful for file testFortranCompiler.f.

  Linking Fortran executable cmTryCompileExec3078717336

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec3078717336.dir/link.txt --verbose=1

  /opt/ibm/xlf/15.1.5/bin/xlf90_r -g -cpp -qxlf2003=POLYmorphic
  -qsuffix=cpp=f90 -qextname -qdirective='IBM*' -qport=typlssarg
  CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o -o
  cmTryCompileExec3078717336

  /opt/ibm/xlf/15.1.5/bin/.orig/xlf90_r: 1501-294 (S) No input file
  specified.  Please use -qhelp for more information.

  gmake[2]: *** [cmTryCompileExec3078717336] Error 249

  gmake[2]: Leaving directory

`/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp'


  gmake[1]: *** [cmTryCompileExec3078717336/fast] Error 2

  gmake[1]: Leaving directory

`/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp'

This is due to the preprocessing flags given at link time.
I could solve it by renaming all my .f90 into .F90 files but, with cray
compiler, I have an other issue that also need to separate link and compile
flags.

Regards,

Xavier LACOSTE
-- 

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