[cmake-developers] [CMake 0015977]: include_directories() gags on ".." embedded in directory path

Mantis Bug Tracker mantis at public.kitware.com
Tue Feb 16 20:28:46 EST 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=15977 
====================================================================== 
Reported By:                Richard Lang
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15977
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-02-16 20:28 EST
Last Modified:              2016-02-16 20:28 EST
====================================================================== 
Summary:                    include_directories() gags on ".." embedded in
directory path
Description: 
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.

 

Additional Information: 
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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-02-16 20:28 Richard Lang   New Issue                                    
======================================================================



More information about the cmake-developers mailing list