Notes |
|
(0035304)
|
Brad King
|
2014-03-05 11:44
|
|
From the include_directories command documentation:
http://www.cmake.org/cmake/help/v3.0/command/include_directories.html [^]
"Relative paths are interpreted as relative to the current source directory."
The placeholder looks like a relative path. Some placeholders are meant to be part of a path rather than a full path, and there is no way to know the difference.
What are you trying to accomplish with the placeholder approach? |
|
|
(0035308)
|
tibur
|
2014-03-05 12:41
|
|
Due to a include conflict, I need to reset Visual Studio $(IncludePath) before any other include directory.
Say I have this CMakeLists.txt:
include_directories(c:/BrokenIncludeDir")
This will generate:
<AdditionalIncludeDirectories>c:/BrokenIncludeDir;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
While I would like the C:/BrokenIncludeDir to be after %(AdditionalIncludeDirectories).
In the IDE, I can fix that by adding $(IncludePath) before c:/BrokenIncludeDir.
I tried to set the AFTER option, but the resulting order is the same. |
|
|
(0035310)
|
Brad King
|
2014-03-05 13:02
|
|
Re 0014787:0035308: The AFTER option is for ordering among CMake-specified directories. Compilers typically keep the system include directories to themselves and there is no way to add things after them. IIRC the %(AdditionalIncludeDirectories) placeholder does not represent the system include directories anyway so its location does not matter.
Prepending $(IncludePath) is a platform- and generator-specific hack to solve this problem. It will not work with other generators such as "NMake Makefiles" or "Ninja". Some options are:
- Fix the breakage
- Use -Ic:/ and #include <BrokenIncludeDir/header.h> to work around it. This could be packaged inside wrapper headers to avoid modifying most of the existing sources.
- Add a cache entry to let the user specify the system include directories and then add them with the BEFORE option of include_directories. This essentially prepends $(IncludePath) in its explicit form. |
|
|
(0035311)
|
tibur
|
2014-03-05 13:15
|
|
We already have the third workaround in place.
I think that adding, say a VERBATIM option to include_directories, preventing to prepend the current directory would do the trick nicely.
But if you don't think it might get useful, I guess we can close the ticket. |
|
|
(0035312)
|
Brad King
|
2014-03-05 13:33
|
|
Re 0014787:0035311: I think it is reasonable to assume that if a path starts in "$(" then we can just trust that it has what the user wants and not treat it as a relative path. I would be open to a change accomplishing this. Note it also will need to adjust the implementation of policy CMP0021:
http://www.cmake.org/cmake/help/v3.0/policy/CMP0021.html [^]
to not reject such paths as relative.
|
|
|
(0035318)
|
Stephen Kelly
|
2014-03-05 16:13
|
|
You might also try this hack:
include_directories($<1:$(BlahBlahBlah)>) |
|
|
(0035320)
|
Brad King
|
2014-03-05 16:16
|
|
|
|
(0035321)
|
Stephen Kelly
|
2014-03-05 16:18
|
|
Ah, indeed. That's evaluated late now. |
|
|
(0042498)
|
Kitware Robot
|
2016-06-10 14:29
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|