Skip to content

Commit

Permalink
CMake: align .pc variables with autoconf
Browse files Browse the repository at this point in the history
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: AOMediaCodec/libavif#1220

Change-Id: I6fbc016c0009ede42e1e5db3a9ee7ae9545d8da0
  • Loading branch information
jzern committed Dec 15, 2022
1 parent e5fe2cf commit 1d58575
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Expand Up @@ -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)

Expand Down

0 comments on commit 1d58575

Please sign in to comment.