[cmake-developers] Generator expressisons in target properties
Stephen Kelly
steveire at gmail.com
Sun Nov 18 16:12:14 EST 2012
Stephen Kelly wrote:
> 1) Policy
>
> The include directories and compile definitions are set by the
> target_link_libraries command. It might make sense to add a policy for
> that feature, as otherwise the order of include directories would change,
> eg:
>
> add_executable(foo ...)
> target_link_libraries(foo bar bat)
> include_directories(${bat_INCLUDE_DIRS} ${bar_INCLUDE_DIRS})
>
I'd like to return to this issue.
add_executable(foo ...)
target_link_libraries(foo bar bat)
include_directories(${bat_INCLUDE_DIRS} ${bar_INCLUDE_DIRS})
will generate
-Ibat -Ibar
before my topic, and
-Ibar -Ibat
afterward.
I think I can add a policy for this by keeping track of whether each include
came from a tll() call or another method. If another method tries to add an
include which is already there, check if it is there because of a tll()
call, and if it is, remove it from there and append it in the new call.
This will require that the INCLUDE_DIRECTORIES properties not be handled in
the regular way, but as a std::vector<IncludeDirectoryEntry> where:
struct IncludeDirectoryEntry
{
cmCompiledGeneratorExpression ge;
bool IsCMP0020Entry;
};
On the plus-side this means that we'll get proper backtraces from errors in
generator expressions for includes.
Any thoughts on that?
Thanks,
Steve.
More information about the cmake-developers
mailing list