[CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Biddiscombe, John A.
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 g

Re: [CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Marc CHEVRIER
Have a look at '$' and '$' generator expressions. Le mar. 9 oct. 2018 à 09:48, Biddiscombe, John A. 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

Re: [CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Petr Kmoch
Hi John, you could put those flags as PUBLIC into a separate INTERFACE target (let's call it hpxFlags) and then do target_libraries(hpx PRIVATE hpxFlags) Then create another interface target hpxForTests to combine those two targets: target_link_libraries(hpxForTests PUBLIC hpx hpxFlags) A

Re: [CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Biddiscombe, John A.
Marc Thank you. That fixes it. JB From: Marc CHEVRIER [marc.chevr...@gmail.com] Sent: 09 October 2018 09:52 To: Biddiscombe, John A. Cc: cmake@cmake.org Subject: Re: [CMake] target_compile_flags and PUBLIC Have a look at '$' and '$' genera