This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1100

Summary: CMAKE_INSTALL_PREFIX used incorrectly
Product: Eigen Reporter: Taylor Braun-Jones <taylor>
Component: GeneralAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Compilation Problem CC: chtz, gael.guennebaud, hmbright, jacob.benoit.1, ludo, manisandro
Priority: Normal    
Version: 3.2   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 558, 711    
Attachments:
Description Flags
Fix CMAKE_INSTALL_PREFIX missing from generated eigen3.pc
none
Fix CMAKE_INSTALL_PREFIX missing from generated eigen3.pc none

Description Taylor Braun-Jones 2015-10-29 21:47:11 UTC
The DESTINATION provided to the `install` command should not be prefixed with ${CMAKE_INSTALL_PREFIX} - it breaks things like CMAKE_STAGING_PREFIX (and probably other use cases as well). From `cmake --help-command install`:

       DESTINATION arguments specify the directory on disk to which a file
       will be installed.  If a full path (with a leading slash or drive
       letter) is given it is used directly.  If a relative path is given it
       is interpreted relative to the value of CMAKE_INSTALL_PREFIX.  The
       prefix can be relocated at install time using DESTDIR mechanism
       explained in the CMAKE_INSTALL_PREFIX variable documentation.

So, for example, instead of:

  set(INCLUDE_INSTALL_DIR
    "${CMAKE_INSTALL_PREFIX}/include/eigen3"
    CACHE INTERNAL
    "The directory where we install the header files (internal)"
  )

It should simply be:

  set(INCLUDE_INSTALL_DIR
    "include/eigen3"
    CACHE INTERNAL
    "The directory where we install the header files (internal)"
  )
Comment 1 Gael Guennebaud 2015-10-30 14:16:15 UTC
Thank you for the hint, fixed in devel and 3.2 branches:
https://bitbucket.org/eigen/eigen/commits/d26ebad
https://bitbucket.org/eigen/eigen/commits/1f02e55
Comment 2 Sandro Mani 2015-11-06 14:25:50 UTC
This unfortunately breaks the eigen3.pc file, which now has

Cflags: -Iinclude/eigen3 

instead of

Cflags: -I/usr/include/eigen3
Comment 3 Taylor Braun-Jones 2015-11-06 14:47:36 UTC
Created attachment 622 [details]
Fix CMAKE_INSTALL_PREFIX missing from generated eigen3.pc
Comment 4 Taylor Braun-Jones 2015-11-06 14:49:22 UTC
The attached patch follows the convention described at the bottom of this page:

https://autotools.io/pkgconfig/file-format.html
Comment 5 Sandro Mani 2015-11-06 19:51:16 UTC
That patch won't work because ${prefix} will be replaced by an empty string when cmake configures the file, since it thinks that its a variable which it should replace.
Comment 6 Taylor Braun-Jones 2015-11-07 02:13:22 UTC
Created attachment 623 [details]
Fix CMAKE_INSTALL_PREFIX missing from generated eigen3.pc

Whoops, you're right. This updated patch fixes that -- and has actually be tested this time :-)
Comment 7 Sandro Mani 2015-11-07 11:37:47 UTC
Thanks
Comment 8 Taylor Braun-Jones 2015-11-08 02:36:00 UTC
Actually, the eigen3.pc wasn't the only thing that broke. Here's a more complete patch to fix the CMAKE_INSTALL_PREFIX correctness in Eigen:

https://bitbucket.org/eigen/eigen/pull-requests/143/
Comment 9 Taylor Braun-Jones 2015-11-08 04:13:14 UTC
Updated pull request:

https://bitbucket.org/eigen/eigen/pull-requests/144/
Comment 10 Gael Guennebaud 2015-12-10 14:50:07 UTC
*** Bug 1114 has been marked as a duplicate of this bug. ***
Comment 11 Gael Guennebaud 2015-12-10 14:51:01 UTC
Thank you for the updated PR.

devel: https://bitbucket.org/eigen/eigen/commits/1db6cf71f628/
3.2: https://bitbucket.org/eigen/eigen/commits/35a341924dae/
Comment 12 Gael Guennebaud 2015-12-10 15:18:44 UTC
*** Bug 1072 has been marked as a duplicate of this bug. ***
Comment 13 Nobody 2019-12-04 15:07:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1100.