diff options
author | Biswapriyo Nath <nathbappai@gmail.com> | 2022-06-24 23:51:20 +0530 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2023-02-16 15:33:22 +0100 |
commit | 8ad2c4ed3d6d689ccf6ac1006fd9d26880eece81 (patch) | |
tree | 8103e9841005d2e454df22f1c370b739cb459b3f | |
parent | 3137fa520042c2d1ebfadae25a214517664ef7b2 (diff) | |
download | cmocka-8ad2c4ed3d6d689ccf6ac1006fd9d26880eece81.zip cmocka-8ad2c4ed3d6d689ccf6ac1006fd9d26880eece81.tar.gz cmocka-8ad2c4ed3d6d689ccf6ac1006fd9d26880eece81.tar.bz2 |
cmake: Fix path relocation in pkgconfig file for mingw
This fixes path relocation in mingw environment by using predefined
Libs and Cflags variable in pkgconfig file. Otherwise, libdir and
includedir are not shown in pkgconf output. e.g.
* Without predefined variables:
- pkgconf -cflags cmocka: No output
- pkgconf -libs cmocka: -lcmocka
* With predefined variables:
- pkgconf -cflags cmocka: -IC:/msys64/mingw64/include
- pkgconf -libs cmocka: -LC:/msys64/mingw64/lib -lcmocka
Also official documentation suggests to use predefiend keywords here
https://people.freedesktop.org/~dbn/pkg-config-guide.html
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmocka.pc.cmake | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 362e3b5..42a0b1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ if (WITH_EXAMPLES) endif () # pkg-config file -configure_file(cmocka.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc) +configure_file(cmocka.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc diff --git a/cmocka.pc.cmake b/cmocka.pc.cmake index f54d0a7..ee189c6 100644 --- a/cmocka.pc.cmake +++ b/cmocka.pc.cmake @@ -1,5 +1,11 @@ -Name: ${PROJECT_NAME} +# cmocka pkg-config source file + +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ Description: The cmocka unit testing library -Version: ${PROJECT_VERSION} -Libs: -L${CMAKE_INSTALL_FULL_LIBDIR} -lcmocka -Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR} +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lcmocka +Cflags: -I${includedir} |