tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

Cmake dependencies broken when installing with `CMAKE_INSTALL_PREFIX`

Open dpipemazo opened this issue 7 years ago • 0 comments

The following commits seem to have broken non-standard Cmake installations when using CMAKE_INSTALL_PREFIX:

b54cf3cb4531a62592fe8679ce264fe272e1cd36
d89d6d9551e5343de4f70ac534f61c3057713f92

After these commits, the resultant file in $(CMAKE_INSTALL_PREFIX)/lib/pkgconfig/tinyxml2.pc is:

prefix=$(CMAKE_INSTALL_PREFIX)
exec_prefix=${prefix}
libdir=lib
includedir=include

Name: TinyXML2
Description: simple, small, C++ XML parser
Version: 6.2.0
Libs: -L${libdir} -ltinyxml2
Cflags: -I${includedir}

The prefix, then, is no longer included in libdir and includedir. This is an issue when specifying a dependency on this install when using:

DCMAKE_PREFIX_PATH="$(CUSTOM_INSTALL_LOCATION)"

when trying to compile another package with cmake that depends on tinyxml2. Now, cmake thinks the tinyxml2 files can be found at /lib and /include when in reality they are at $(CUSTOM_INSTALL_LOCATION)/lib and $(CUSTOM_INSTALL_LOCATION)/include.

I went back to tag 6.2.0 and verified that tinyxml2.pc is correctly:

prefix=$(CMAKE_INSTALL_PREFIX)
exec_prefix=${prefix}
libdir=$(CMAKE_INSTALL_PREFIX)/lib
includedir=$(CMAKE_INSTALL_PREFIX)/include

Name: TinyXML2
Description: simple, small, C++ XML parser
Version: 6.2.0
Libs: -L${libdir} -ltinyxml2
Cflags: -I${includedir}

I agree that relocatable installs are nice, but perhaps they should probably be done by re-installing with CMAKE_INSTALL_PREFIX as opposed to manually copying the files. There doesn't seem to be a good way to specify a dependency from another cmake-style package to a non-standard tinyxml2 install otherwise.

dpipemazo avatar Jul 24 '18 21:07 dpipemazo