On 2013-03-13 20:59, Matthew Woehlke wrote:
This simple CMakeLists.txt is broken with ninja:

cmake_minimum_required(VERSION 2.8.10.20130312)
project(Foo)

add_executable(foo foo.cpp)

target_include_directories(foo PUBLIC
   $<BUILD_INTERFACE:${Foo_BINARY_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
)

...with Ninja, the include directive passed to the compiler is '-I.'
(with the binary dir prefix similarly stripped for anything after the ${}).

It seems okay with the Makefile generator.

This does appear to be a CMake problem, and not a ninja problem, as in
the build.ninja I am seeing 'FLAGS = -I.'.

It would be nice to have this fixed before 2.8.11 final :-).

(Note: I haven't yet checked if the installed exports file is okay,
since this is preventing my project from building, although presumably
that is at least not generator dependent.)

...and it occurred to me that this might be happening because of a misguided optimization to strip unnecessary prefixing of the expected working directory from include paths.

First off, it's broken, because I'm being bit by this where the directory I want to include is NOT the current binary directory (Foo_BINARY_DIR is in fact a parent of CMAKE_CURRENT_BINARY_DIR). Second, performing such an optimization is inherently broken (although depends where the optimization is happening) for public include_directories.

It may be that someone made an 'oops' when writing the generator code and wrote a CMAKE_BINARY_DIR (or equivalent) where CMAKE_CURRENT_BINARY_DIR was intended/needed.

--
Matthew

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to