Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HEADERS variable to set public header property of libjapi. PUBLIC… #137

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,18 @@ set_property(TARGET japi_objs PROPERTY POSITION_INDEPENDENT_CODE ON)
add_library(japi SHARED $<TARGET_OBJECTS:japi_objs>)
add_library(japi-static STATIC $<TARGET_OBJECTS:japi_objs>)

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)
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
PUBLIC_HEADER DESTINATION include
PUBLIC_HEADER DESTINATION include/japi
)

################################
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ A Makefile is generated. Run 'make' to build the libjapi libraries.

A shared and a static library is built. Tests are built by default. They can be disabled using the command `cmake -DLIBJAPI_ENABLE_TESTING=OFF ../` variable.

Install the shared and static japi library together with public header files:

$ make install

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.
### Tests
To run the internal tests run

$ ctest

### Tests
The testsuite from [googletest](https://github.com/google/googletest) is used. To run tests, call

$ cd build
Expand Down