From e008556cbd0b395e6439c1c5238161297bf25e07 Mon Sep 17 00:00:00 2001 From: baronml Date: Mon, 4 Nov 2024 18:00:33 +0100 Subject: [PATCH 1/4] Use HEADERS variable to set public header property of libjapi. PUBLIC_HEADERS as a variable was not set and thus leading to no installed headers --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddb8a31..b9b7be1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ set_property(TARGET japi_objs PROPERTY POSITION_INDEPENDENT_CODE ON) add_library(japi SHARED $) add_library(japi-static STATIC $) -set_target_properties(japi PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}" +set_target_properties(japi PROPERTIES PUBLIC_HEADER "${HEADERS}" SOVERSION ${SOVERSION}) target_link_libraries(japi PkgConfig::JSONC) From d4e9dc54c4220d3f6d7ad09e85a83786f7550db1 Mon Sep 17 00:00:00 2001 From: baronml Date: Tue, 5 Nov 2024 08:58:28 +0100 Subject: [PATCH 2/4] Update README.md with install instructions for libjapi. Libjapi will be installed as a user module with libraries in /usr/local/lib and header files i /usr/local/include/ --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5b6fffe..5c5f37a 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,12 @@ To run the internal tests run $ ctest +Install the shared japi library together with public header files: + + $ make install + +Make sure to add `/usr/local/include/` to your local system environment `C_INCLUDE_PATH` or `CPLUS_INCLUDE_PATH` and that `/usr/local/lib/` is in the standard linker search path when compiling and linking your application against libjapi. + ## Demo You can clone the [demo project](https://git01.iis.fhg.de/ks-ip-lib/software/libjapi-demo), with examples for all features from the repository listed below: From 28e66fa60750e1d081954c59485f7111cda86e87 Mon Sep 17 00:00:00 2001 From: baronml Date: Tue, 5 Nov 2024 09:07:09 +0100 Subject: [PATCH 3/4] Extend cmake install to install shared AND static japi library. The user can then decide to use either static or shared libjapi when using the installed libjapi version for building an application. --- CMakeLists.txt | 5 ++--- README.md | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9b7be1..22ac796 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,8 @@ set_target_properties(japi PROPERTIES PUBLIC_HEADER "${HEADERS}" target_link_libraries(japi PkgConfig::JSONC) target_link_libraries(japi-static PkgConfig::JSONC) -# only install libjapi.so because the static version is usually linked directly -# from the build directory -install(TARGETS japi +# install shared and static japi library (.so and .a) +install(TARGETS japi japi-static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib diff --git a/README.md b/README.md index 5c5f37a..3ccc0a2 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To run the internal tests run $ ctest -Install the shared japi library together with public header files: +Install the shared and static japi library together with public header files: $ make install From 9e782456d1d78c6c7efe5ffcbad17a817a363556 Mon Sep 17 00:00:00 2001 From: baronml Date: Tue, 5 Nov 2024 09:29:22 +0100 Subject: [PATCH 4/4] Install japi header files into subfolder include/japi to avoid namespace pollution (A file like networking.h could potentially be also used in another library and could lead to problems). The same convention like for the json-c library is used which header files are installed at /usr/include/json-c. This change is backwards compatible since the include files were not available before this commit. --- CMakeLists.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22ac796..e5ae18f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ install(TARGETS japi japi-static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include + PUBLIC_HEADER DESTINATION include/japi ) ################################ diff --git a/README.md b/README.md index 3ccc0a2..d0bca73 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Install the shared and static japi library together with public header files: $ make install -Make sure to add `/usr/local/include/` to your local system environment `C_INCLUDE_PATH` or `CPLUS_INCLUDE_PATH` and that `/usr/local/lib/` is in the standard linker search path when compiling and linking your application against libjapi. +Make sure to add `/usr/local/include/japi/` to your local system environment `C_INCLUDE_PATH` or `CPLUS_INCLUDE_PATH` and that `/usr/local/lib/` is in the standard linker search path when compiling and linking your application against libjapi. ## Demo You can clone the [demo project](https://git01.iis.fhg.de/ks-ip-lib/software/libjapi-demo), with examples for all features from the repository listed below: