Have a look at '$<BUILD_INTERFACE:...>' and '$<INSTALL_INTERFACE:...>' generator expressions.
Le mar. 9 oct. 2018 à 09:48, Biddiscombe, John A. <biddi...@cscs.ch> a écrit : > I have a problem with exported flags from a project. > > If I use `target_compile_options(hpx PUBLIC ${flags})` hpx is compiled > with the flags, and all 500+ tests within the project that depend on hpx > inherit the flags too, so they get built correctly. However, the > `HPXTargets.cmake` file that is generated with the exported targets, also > inherits these flags and lists them in INTERFACE_COMPILE_OPTIONS, so now > users are complaining that flags used to compile hpx are being passed onto > their project and some of the stuff we use like `-Werror=sign-compare` > causes a build fail in their project. If I use `target_compile_options(hpx > PRIVATE ${flags})` then the flags are not passed on to the user projects, > but also not passed on to the tests either. Is there an easy way of saying, > pass these flags to all my projects within this 'PROJECT' but don't export > them via the PUBLIC/INTERFACE to 3rd party users? > > Thanks > > JB > -- > > 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 >
-- 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