View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014787 | CMake | CMake | public | 2014-03-05 09:12 | 2016-06-10 14:31 | ||||
Reporter | tibur | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Windows | OS | Windows | OS Version | Win7 | ||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014787: Unable to include a directory named after a Visual Studio macro. | ||||||||
Description | I am trying to include a directory defined by a Visual Studio macro name ($(BlahBlahBlah)). Using the following CMakeLists.txt, CMake concatenates the project working dir (d:/taf/Blah) with my macro name, leading to a wrong include directory. | ||||||||
Steps To Reproduce | cmake_minimum_required(VERSION 2.8) include_directories("c:/") include_directories("$(BlahBlahBlah)") include_directories("d:/") add_executable(Blah main.cpp) Produces: <AdditionalIncludeDirectories>c:\;d:\Taf\Blah\$(BlahBlahBlah);d:\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0035304) Brad King (manager) 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 (reporter) 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 (manager) 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 (reporter) 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 (manager) 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 (developer) 2014-03-05 16:13 |
You might also try this hack: include_directories($<1:$(BlahBlahBlah)>) |
(0035320) Brad King (manager) 2014-03-05 16:16 |
Re 0014787:0035318: CMP0021 makes that an error. |
(0035321) Stephen Kelly (developer) 2014-03-05 16:18 |
Ah, indeed. That's evaluated late now. |
(0042498) Kitware Robot (administrator) 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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-03-05 09:12 | tibur | New Issue | |
2014-03-05 11:44 | Brad King | Note Added: 0035304 | |
2014-03-05 12:41 | tibur | Note Added: 0035308 | |
2014-03-05 13:02 | Brad King | Note Added: 0035310 | |
2014-03-05 13:15 | tibur | Note Added: 0035311 | |
2014-03-05 13:33 | Brad King | Note Added: 0035312 | |
2014-03-05 13:33 | Brad King | Status | new => backlog |
2014-03-05 16:13 | Stephen Kelly | Note Added: 0035318 | |
2014-03-05 16:16 | Brad King | Note Added: 0035320 | |
2014-03-05 16:18 | Stephen Kelly | Note Added: 0035321 | |
2014-07-02 11:15 | Brad King | Relationship added | related to 0015001 |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042498 | |
2016-06-10 14:29 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |