MantisBT - CMake
View Issue Details
0015977CMakeCMakepublic2016-02-16 20:282016-06-10 14:21
Richard Lang 
 
normalminoralways
closedfixed 
Windows 7 64 bit
CMake 3.3.1 
CMake 3.4.3 
0015977: include_directories() gags on ".." embedded in directory path
Working on port of collection of existing projects from proprietary toolchain to cmake, where some source and include files reside in sibling/common ancestor folders of of the project folders


   |-- SharedSource
   | |--SharedSource1.c
   | |--SharedSource2.c
   | +--SharedSource1.h
   +-- Project1
   | |--Project1.c
   | +--MakeLists.txt
   +-- Project2
        |--Project2.c
        +--MakeLists.txt

Using Windows native cmake v3.4.1 I can quite happily specify "SharedSource" as an include directory in my project cmake scripts using a "../' parent directory relative reference as follows:


  ...
  include_directories(../SharedSource)
  ...

however when I try and run the same script using cmake within the cygwin & MSYS2 UNIX emulation environments it fails with a "Found relative path while evaluating include directories" message.

The problem still occurs when I explicitly prepend CMAKE_CURRENT_SOURCE_DIR on the path, as follows

  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../SharedSource)

The cygwin cmake version is 3.3.1, while the MSYS2 one is 3.2.3, and probably reflects the current version in these environments, as I've installed them pretty recently.

 
Don't currently have a native UNIX/linux environment to try this on. I'm a UNIX novice, but AFAIK "../SharedSource" should be a valid relative path on UNIX platforms.

Can't see anything obvious in the bug tracker that would suggest that this has been fixed between 3.3.1 and 3.4.1, suggesting it's maybe a platform idiosyncrasy.
No tags attached.
Issue History
2016-02-16 20:28Richard LangNew Issue
2016-02-17 09:38Brad KingNote Added: 0040497
2016-02-17 15:33Richard LangNote Added: 0040502
2016-02-17 15:35Brad KingStatusnew => resolved
2016-02-17 15:35Brad KingResolutionopen => fixed
2016-02-17 15:35Brad KingFixed in Version => CMake 3.4.3
2016-06-10 14:21Kitware RobotNote Added: 0041247
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040497)
Brad King   
2016-02-17 09:38   
Please try 3.4 or later in the environment where you see the warning with 3.3 or 3.2. Binaries for 3.4 on cygwin are available here:

 https://cmake.org/files/v3.4/cygwin/ [^]

Or you can build from source.
(0040502)
Richard Lang   
2016-02-17 15:33   
The 3.4.3 cygwin build appears to work correctly thanks Brad.

Unfortunately some other issues prevent me from using the cygwin version of cmake (a native Windows compiler toolchain that can't handle cygwin paths) so I've been playing with MSYS2 as an alternative. Will give them a nudge regarding ensuring the latest cmake version is included in the next build.
(0041247)
Kitware Robot   
2016-06-10 14:21   
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.