[CMake] Removing Transitively Inherited Properties

Sergei Nikulov sergey.nikulov at gmail.com
Tue Feb 6 05:47:50 EST 2018


2018-02-06 13:15 GMT+03:00 Geogin Varghese <geogin at gmail.com>:
> What is the recommended way of removing transitively inherited
> attributes for a target.
>
> Example:
> target_link_libraries(A PRIVATE B)
> target_compile_options(B PUBLIC -Werror)
>

Shouldn't it be PRIVATE for B?
E.g.  target_compile_options(B PRIVATE -Werror)

https://cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#build-specification-and-usage-requirements

"
Each of the commands has a PRIVATE, PUBLIC and INTERFACE mode. The
PRIVATE mode populates only the non-INTERFACE_ variant of the target
property and the INTERFACE mode populates only the INTERFACE_
variants. The PUBLIC mode populates both variants of the respective
target property.
"


> How should the -Werror option be removed from target A.
> --
>
> 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



-- 
Best Regards,
Sergei Nikulov


More information about the CMake mailing list