Skip to content

pkg-config file contains incorrect path when INCLUDE_INSTALL_DIR is overriden #279

@mgorny

Description

@mgorny

Long story short:

$ cmake .. -DJSONCPP_WITH_PKGCONFIG_SUPPORT=1 
-- JsonCpp Version: 1.6.2
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/jsoncpp-1.6.2/_build
$ grep includedir= pkg-config/jsoncpp.pc 
includedir=${prefix}/include

Correct so far. However, if I change INCLUDE_INSTALL_DIR to another name:

$ cmake .. -DJSONCPP_WITH_PKGCONFIG_SUPPORT=1 -DINCLUDE_INSTALL_DIR=test
-- JsonCpp Version: 1.6.2
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/jsoncpp-1.6.2/_build
$ grep includedir= pkg-config/jsoncpp.pc 
includedir=${prefix}//tmp/jsoncpp-1.6.2/_build/test

An absolute path with build directory is put there, after the prefix. And if I pass an absolute path:

$ cmake .. -DJSONCPP_WITH_PKGCONFIG_SUPPORT=1 -DINCLUDE_INSTALL_DIR=/usr/include/jsoncpp
-- JsonCpp Version: 1.6.2
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/jsoncpp-1.6.2/_build
$ grep includedir= pkg-config/jsoncpp.pc 
includedir=${prefix}//usr/include/jsoncpp

Then the prefix is duplicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions