You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
3 years ago
|
find_package(PkgConfig REQUIRED)
|
||
|
|
||
2 years ago
|
set(ROOT "${CMAKE_CURRENT_BINARY_DIR}/root")
|
||
|
string(REPLACE " " "\\ " ESCAPED_ROOT "${ROOT}")
|
||
|
set(LIB_DIR "${ROOT}/lib")
|
||
1 year ago
|
set(INCLUDE_DIR "${ROOT}/include")
|
||
2 years ago
|
set(PKGCONFIG_DIR "${LIB_DIR}/pkgconfig")
|
||
|
|
||
|
file(WRITE "${PKGCONFIG_DIR}/zot.pc" "
|
||
|
prefix=${ESCAPED_ROOT}
|
||
3 years ago
|
libdir=\${prefix}/lib
|
||
1 year ago
|
includedir=\${prefix}/include
|
||
3 years ago
|
|
||
|
Name: Zot
|
||
2 years ago
|
Description: Dummy package to test LIBRARY_DIR support
|
||
3 years ago
|
Version: 1.0
|
||
|
Libs: -L\${libdir} -lzot
|
||
1 year ago
|
Cflags: -I\${includedir}
|
||
3 years ago
|
")
|
||
|
|
||
|
# Create a "library" file to find in libdir.
|
||
|
set(CMAKE_FIND_LIBRARY_PREFIXES "prefix-")
|
||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES "-suffix")
|
||
2 years ago
|
file(WRITE "${LIB_DIR}/prefix-zot-suffix")
|
||
3 years ago
|
|
||
|
# 'pkg-config --libs' drops -L flags in PKG_CONFIG_SYSTEM_LIBRARY_PATH by default.
|
||
2 years ago
|
set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${LIB_DIR}")
|
||
1 year ago
|
# 'pkg-config --cflags' drops -I flags in PKG_CONFIG_SYSTEM_INCLUDE_PATH by default.
|
||
|
set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "${INCLUDE_DIR}")
|
||
3 years ago
|
|
||
|
# 'pkgconf --libs' also drops -L flags in LIBRARY_PATH by default.
|
||
2 years ago
|
set(ENV{LIBRARY_PATH} "${LIB_DIR}")
|
||
1 year ago
|
# 'pkgconf --cflags' also drops -I flags in CPATH by default.
|
||
|
set(ENV{CPATH} "${INCLUDE_DIR}")
|
||
3 years ago
|
|
||
2 years ago
|
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_DIR}")
|
||
3 years ago
|
pkg_check_modules(ZOT REQUIRED zot)
|
||
|
|
||
|
message(STATUS "ZOT_LIBRARIES='${ZOT_LIBRARIES}'")
|
||
|
message(STATUS "ZOT_LINK_LIBRARIES='${ZOT_LINK_LIBRARIES}'")
|
||
|
message(STATUS "ZOT_LDFLAGS='${ZOT_LDFLAGS}'")
|
||
1 year ago
|
message(STATUS "ZOT_CFLAGS='${ZOT_CFLAGS}'")
|