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

added BUILD_TESTS cmake option #41

Open
wants to merge 1 commit into
base: master
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
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ include(CTest)

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

option(BUILD_TESTS "Build unit tests" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Support 'make uninstall'.
Expand Down Expand Up @@ -37,11 +39,6 @@ set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib

# -- Dependencies -------------------------------------------------------------

find_package(Threads)
if (NOT Threads_FOUND)
message(FATAL_ERROR "Could not find system threading libraries")
endif ()

set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
Expand Down Expand Up @@ -86,4 +83,13 @@ set_target_properties(libbf PROPERTIES OUTPUT_NAME bf)
install(TARGETS libbf DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bf DESTINATION include)

add_subdirectory(test)
# -- Tests -------------------------------------------------------------------

if (BUILD_TESTS)
find_package(Threads)
if (NOT Threads_FOUND)
message(FATAL_ERROR "Could not find system threading libraries")
endif ()

add_subdirectory(test)
endif (BUILD_TESTS)
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,32 @@ Requirements
Installation
============

The build process uses CMake, wrapped in autotools-like scripts. The configure
script honors the `CXX` environment variable to select a specific C++compiler.
For example, the following steps compile libbf with Clang and install it under
`PREFIX`:

CXX=clang++ ./configure --prefix=PREFIX
make
make test
make install
The build process uses CMake. For example, the following steps compile libbf
with Clang and install it under `PREFIX`:

```bash
cd {path to the cloned repository}
mkdir build
cd build
CXX=clang++ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX} -DBUILD_TESTS=OFF
make
make install
```

Documentation
=============

The most recent version of the Doxygen API documentation exists at
<http://mavam.github.io/libbf/api>. Alternatively, you can build the
documentation locally via `make doc` and then browse to
`doc/gh-pages/api/index.html`.
documentation locally via:

```
cd {path to the cloned repository}
cd doc
make doc
```

and then browse to `{repo}/doc/gh-pages/api/index.html`.

Usage
=====
Expand Down