I'm attempting to use a generator expression to conditionally add compile
options. No problem if it is a single option, but I can't figure out how to
manage multiple options (in a single command).

For example, this works:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall>)

As does this:
add_compile_options(-Wall -Wextra)

But not this:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall -Wextra>)

Nor this:
add_compile_options($<$<COMPILE_LANGUAGE:C>"-Wall -Wextra">)

Or any other variation I could think of.  Either the space breaks the
generator expression, or I get a quoted version of the options that the
compiler sees as a single "option" it doesn't understand.

Is there some way of doing this?

PS: I'm trying to avoid using CMAKE_C_FLAGS. My understanding is that
variable is meant for the end user's use.  Am I mistaken about that?
-- 

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

Reply via email to