Remove absolute path from INCLUDE_INSTALL_DIR
Needs ReviewPublic

Authored by omalsa on Fri, Nov 22, 10:03 AM.

Details

Reviewers
None
Group Reviewers
Marble
Summary

The absolute path in INCLUDE_INSTALL_DIR eventually made it into the exported MarbleTargets.cmake file in the INTERFACE_INCLUDE_DIRECTORIES target property.

There should be _no_ absolute paths in any outputs of install.

This bug causes the following use-case to fail:

  • Make Install marble
  • Move/deploy install directory to another location (e.g. deploy from Continuous Integration server)
  • Link to Marble from new cmake project with find_package(Marble)

Because of this absolute path, the install directory cannot be moved after it is created.

This is the CMake error:

CMake Error in src/libs/geo/CMakeLists.txt
  Imported target "Marble" includes non-existent path

    "/absolute/path/to/include/dirs/that/doesnt/exist"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully.
  * The installation package was faulty and references files it does not provide.

The following is a minimal example CMakeLists.txt file that can produce the error:

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(Geo VERSION 1.0)
find_package(Marble REQUIRED)
add_executable(geo PRIVATE main.cpp)
target_link_libraries(PUBLIC Marble)
Test Plan

This bug was found while trying to deploy Marble from our Continuous Integration server. To reproduce:

  1. Build and install marble
  2. Move marble install to a different machine
  3. Try to build a cmake project that depends on libMarble

This will fail because the INTERFACE_INCLUDE_DIRECTORIES contained in the generated MarbleTarget.cmake file is not accessible.

Once my patch is applied then the above steps will work correctly.

Diff Detail

Repository
R34 Marble
Lint
Lint Skipped
Unit
Unit Tests Skipped
omalsa created this revision.Fri, Nov 22, 10:03 AM
Restricted Application added projects: Marble, KDE Edu. · View Herald TranscriptFri, Nov 22, 10:03 AM
Restricted Application added subscribers: kde-edu, marble-devel. · View Herald Transcript
omalsa requested review of this revision.Fri, Nov 22, 10:03 AM
omalsa edited the summary of this revision. (Show Details)Mon, Nov 25, 4:03 AM
omalsa edited the test plan for this revision. (Show Details)

Note: I've raised bug 414554 for this issue.