Exascale
Exascale

Reputation: 963

Why is CMake inserting quotes into compile options that have spaces?

I have compile options in list form like:

set(flags "-auto" "-qopenmp" "-convert big_endian")

Then, I add them to the target:

  target_compile_options(${lib_name} PRIVATE ${flags})

But when I run "make" the compile options with spaces get quotes added to them:

-auto -qopenmp "-convert big_endian"

And then the compiler doesn't recognize it as a flag.

So, why does CMake add quotes to my compile options? Is there any way I can stop it from doing that?

Upvotes: 0

Views: 1456

Answers (1)

Exascale
Exascale

Reputation: 963

Found the fix.

Just have to also quote the option to the flag like so:

"-convert" "big_endian"

Upvotes: 1

Related Questions