diff --git a/CMakeLists.txt b/CMakeLists.txt index 5499612..bff37ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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'. @@ -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") @@ -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) diff --git a/README.md b/README.md index 7399fe4..81903eb 100644 --- a/README.md +++ b/README.md @@ -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 . 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 =====