blt icon indicating copy to clipboard operation
blt copied to clipboard

fortran vs cmake vs compiler flags

Open cyrush opened this issue 3 years ago • 1 comments

BLT blt_add_target_compile_flags is using target_compile_options - if you pass flags as a cmake string, the full string gets quoted before passed to the fortran compiler. This confuses gfortran if you have more than one option.

If these are passed as a cmake list, things make it to the fortran compiler correctly.

I am using blt_append_custom_compiler_flag, which does not seem to be creating a list.

(I am using an older blt, so maybe this has been fixed?)

cyrush avatar Jan 27 '22 20:01 cyrush

If I'm understanding this properly, it sounds like we should be using

blt_list_append(TO foo ELEMENTS bar)

instead of

set(foo "foo bar")

for all the lines in the implementation of blt_append_custom_compiler_flag here:

https://github.com/LLNL/blt/blob/4eafa66ddb99ee5a4a0f75f3d7d790679add6e01/cmake/BLTMacros.cmake#L987-L1034

kennyweiss avatar Jan 27 '22 20:01 kennyweiss