<div dir="ltr">Hi Micha,<div><br></div><div>When using generator expressions inside target_include_directories you must qualify all paths. Either by using absolute paths, or using one of the helper variables that allows CMake to determine where the relative path should be evaluated from.</div><div><br></div><div>This is all really well documented at: <a href="http://www.cmake.org/cmake/help/v3.2/manual/cmake-buildsystem.7.html#include-directories-and-usage-requirements">http://www.cmake.org/cmake/help/v3.2/manual/cmake-buildsystem.7.html#include-directories-and-usage-requirements</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 3:26 AM, Micha Renner <span dir="ltr"><<a href="mailto:Micha.Renner@t-online.de" target="_blank">Micha.Renner@t-online.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I try to understand the concept of generator expressions with little<br>
avail.<br>
<br>
For the current project I thought, I could use them in combination with<br>
TARGET_INCLUDE_DIRECTORIES.<br>
Instead of writting<br>
IF(t1)<br>
        TARGET_INCLUDE_DIRECTORIES(cTest PRIVATE path/to/h1 PRIVATE path/to/h2)<br>
ELSE(t1)<br>
        TARGET_INCLUDE_DIRECTORIES(cTest PRIVATE path/to/h1)<br>
ENDIF(t1)<br>
<br>
it should be more elegant<br>
<br>
SET(t1 ON)<br>
ADD_EXECUTABLE(cTest CTest.c cTest.h)<br>
TARGET_INCLUDE_DIRECTORIES(cTest PRIVATE path/to/h1 $<<br>
$<BOOL:t1>:"PRIVATE path/to/h2")<br>
<br>
Of course this creates a major disaster.<br>
<br>
--------------------------<br>
CMake Warning (dev) in CMakeLists.txt:<br>
  Policy CMP0021 is not set: Fatal error on relative paths in<br>
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy<br>
CMP0021" for<br>
  policy details.  Use the cmake_policy command to set the policy and<br>
  suppress this warning.<br>
<br>
  Found relative path while evaluating include directories of "cTest":<br>
<br>
    ""PRIVATE path/to/h2""<br>
<br>
This warning is for project developers.  Use -Wno-dev to suppress it.<br>
<br>
cmake: /home/gildemeister/Picture/work-c/CMakeSrc/cmake-3.2.1/Source/cmLocalGenerator.cxx:2923: std::string cmLocalGenerator::ConvertToRelativePath(const std::vector<std::basic_string<char> >&, const string&, bool): Assertion `in_remote[0] != '\"'' failed.<br>
Abgebrochen (Speicherabzug geschrieben)<br>
--------------------------<br>
<br>
Is there a way to solve this with a generator expression?<br>
<br>
Michael<br>
<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>