diff options
author | James Zern <jzern@google.com> | 2022-12-14 11:40:14 -0800 |
---|---|---|
committer | James Zern <jzern@google.com> | 2022-12-14 19:21:12 -0800 |
commit | 1d58575b18c63c400f4be9dbfd11ee4e74e3c0a5 (patch) | |
tree | fc62cade2f3cf2c00e9312c30b9f6974bb166c41 | |
parent | e5fe2cfc1bea149106d94ef5233c488ed1287b68 (diff) | |
download | webp-1d58575b18c63c400f4be9dbfd11ee4e74e3c0a5.tar.gz |
CMake: align .pc variables with autoconf
Use prefix/exec_prefix for includedir/libdir if
CMAKE_INSTALL_{LIBDIR,INCLUDEDIR} are relative and the CMake variable
alone if they're absolute.
This matches what autoconf will produce if a custom --libdir or
--includedir are used.
See also: https://github.com/AOMediaCodec/libavif/issues/1220
Change-Id: I6fbc016c0009ede42e1e5db3a9ee7ae9545d8da0
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 15f69b59..4add686d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,9 +128,17 @@ endif() # pkg-config variables used by *.pc.in. set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "\$\{prefix\}") -set(libdir "\$\{prefix\}/lib") -set(includedir "\$\{prefix\}/include") +set(exec_prefix "\${prefix}") +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(libdir "${CMAKE_INSTALL_LIBDIR}") +else() + set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) set(INSTALLED_LIBRARIES) |