Skip to content

Commit

Permalink
Added some documentation on how to use with various buildsystems. #229 (
Browse files Browse the repository at this point in the history
  • Loading branch information
rm5248 authored Nov 27, 2023
1 parent c4def54 commit f38cbfb
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/site/markdown/1-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ See the following pages for usage information:
* @subpage performance
* @subpage conclusions
* @subpage faq
* @subpage buildsystems
79 changes: 79 additions & 0 deletions src/site/markdown/buildsystems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Usage with your build system {#buildsystems}
===
<!--
Note: License header cannot be first, as doxygen does not generate
cleanly if it before the '==='
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
[TOC]

The following code snippets show how to use Log4cxx with various different buildsystems.

Note that we are unable to provide support for all buildsystems that you may be using.

CMake is fully supported for building, as well as any buildsystem that can use `pkgconfig`
in order to find packages. When using `pkgconfig`, the package name is `liblog4cxx`.

# How do I use Log4cxx with CMake? {#use_with_cmake}

Add the following to your CMakeLists.txt file:

~~~
find_package(log4cxx)
... other buildsystem information here ...
target_link_libraries( executable PRIVATE log4cxx )
~~~

# How do I use Log4cxx with CMake and pkg-config? {#use_with_cmake_pkgconfig}

Add the following to your CMakeLists.txt file:

~~~
find_package(PkgConfig)
pkg_check_modules(log4cxx REQUIRED liblog4cxx)
... other buildsystem information here ...
target_link_libraries( executable PRIVATE ${log4cxx_LIBRARIES} )
target_include_directories( executable PRIVATE ${log4cxx_INCLUDE_DIRS} )
~~~


# How do I use Log4cxx with QMake? {#use_with_qmake}

Add the following to your .pro file:

~~~
CONFIG += link_pkgconfig
PKGCONFIG += liblog4cxx
~~~

# How do I use Log4cxx with plain Make? {#use_with_make}

You probably don't want to do this - it is highly recommended to use a proper buildsystem. However, the following minimal Makefile will build and link an application:

~~~
CXXFLAGS += $(shell pkg-config --cflags liblog4cxx)
LDFLAGS += $(shell pkg-config --libs liblog4cxx)
all: main.o
$(CXX) -o application main.o $(LDFLAGS)
~~~

0 comments on commit f38cbfb

Please sign in to comment.