Component compiler options

NevynSelby
Posts: 34
Joined: Thu Dec 24, 2015 12:04 pm

Component compiler options

Postby NevynSelby » Mon Nov 18, 2024 1:12 pm

I am trying to set the compiler options for a specific component in my project, I want this to apply to all of the source files in the component but not to third party components.

I have edited the CMakeLists.txt in my component directory and have tried a few options but the only one I can get working is by setting the options on a file by file basis. So this works:

Code: Select all

set_source_files_properties(Bluetooth/BluetoothRequestHandler.cpp
    PROPERTIES COMPILE_FLAGS
    -Werror=all
)
I have tried the following but I cannot get any of them to work:

* set_property(GLOBAL APPEND PROPERTY COMPILE_FLAGS -Werror=all)
* target_compile_options(${COMPONENT_LIB} PRIVATE -Werror=all)
* target_compile_options(COMPONENT_LIB PUBLIC -Werror=all)
* add_compile_options(-Werror=all)

What is the best way to change the compiler flags for a compoent?

Thanks in advance,
Mark

Who is online

Users browsing this forum: No registered users and 117 guests