Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Fix pkg-config generation when using absolute paths
Assuming that CMAKE_INSTALL_{INCLUDE,LIB}DIR is always a path relative to the prefix can lead to broken paths added to pkg-config if the path is relative. Solution: Check if the paths are absolute and only add the prefix if they are not. Fixes #23
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,18 @@ if(MSVC) | |
target_compile_definitions(unarr PRIVATE _CRT_SECURE_NO_WARNINGS) | ||
endif() | ||
|
||
# Generate paths for pkg-config file | ||
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") | ||
set(PROJECT_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}) | ||
else() | ||
set(PROJECT_INSTALL_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") | ||
endif() | ||
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") | ||
set(PROJECT_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_LIBDIR}) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
selmf
via email
Author
Owner
|
||
else() | ||
set(PROJECT_INSTALL_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") | ||
endif() | ||
|
||
# Write pkg-config file | ||
configure_file("pkg-config.pc.cmake" "lib${PROJECT_NAME}.pc" @ONLY) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thank you for the quick response, but shouldn’t this have been
INCLUDEDIR
?